From: Tanu Kaskinen Date: Fri, 28 Nov 2014 08:55:30 +0000 (+0200) Subject: inidb: Avoid calling fclose() twice X-Git-Tag: accepted/tizen/3.0.2015.q2/common/20150630.080055~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F85%2F30985%2F2;p=platform%2Fupstream%2Fpulseaudio.git inidb: Avoid calling fclose() twice f needs to be set to NULL after calling fclose(), otherwise fclose will be called again in the "fail" section if the first call fails, which results in undefined behaviour (a crash has been observed[1]). [1] https://lists.tizen.org/pipermail/ivi/2014-November/003693.html Change-Id: Iaa1539a379b8be31b62834f49240d17fdf45c893 --- diff --git a/src/modules/volume-api/inidb.c b/src/modules/volume-api/inidb.c index 8116e72..62a2825 100644 --- a/src/modules/volume-api/inidb.c +++ b/src/modules/volume-api/inidb.c @@ -326,6 +326,7 @@ static void save(pa_inidb *db) { } r = fclose(f); + f = NULL; if (r < 0) { pa_log("fclose() failed: %s", pa_cstrerror(errno)); goto fail;