From b69e2e96adab0e6b0c7f0a99cb063947d1183c76 Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Fri, 28 Nov 2014 10:55:30 +0200 Subject: [PATCH] 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 --- src/modules/volume-api/inidb.c | 1 + 1 file changed, 1 insertion(+) 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; -- 2.7.4