[Crash-utility] [PATCH 3/4] Fix gcc-11 compilation warning on makedumpfile.c

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Fri Jul 22 04:44:50 UTC 2022


Without the patch, the following gcc-11 compilation warning is emitted
for makedumpfile.c:

In function 'flattened_format_get_osrelease',
    inlined from 'check_flattened_format' at makedumpfile.c:236:3:
makedumpfile.c:392:9: warning: 'fclose' called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
  392 |         fclose(pipe);
      |         ^~~~~~~~~~~~
makedumpfile.c: In function 'check_flattened_format':
makedumpfile.c:380:21: note: returned from 'popen'
  380 |         if ((pipe = popen(buf, "r")) == NULL)
      |                     ^~~~~~~~~~~~~~~

Signed-off-by: Kazuhito Hagio <k-hagio-ab at nec.com>
---
 makedumpfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index ebf24f5..26d12b6 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -389,5 +389,5 @@ flattened_format_get_osrelease(char *file)
 		}
 	}
 
-	fclose(pipe);
+	pclose(pipe);
 }
-- 
2.31.1



More information about the Crash-utility mailing list