diff --git a/src/api/c/libspeechd.c b/src/api/c/libspeechd.c index 9ebc7565..671ccef1 100644 --- a/src/api/c/libspeechd.c +++ b/src/api/c/libspeechd.c @@ -620,7 +620,9 @@ void spd_close(SPDConnection * connection) } /* close the socket */ - fclose(connection->stream); + if (connection->stream != NULL) + fclose(connection->stream); + connection->stream = NULL; pthread_mutex_unlock(&connection->ssip_mutex);