From 4d4d8b75297c30d7c95c2ab753f2c4493ae221ee Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 19 Aug 2012 23:59:47 -0700 Subject: [PATCH] sys-file-reader: Fix memory leak. The C standards say that the compiler is allowed to optimize away changes to local variables within a function between a call to setjmp() and a later call to longjmp(), unless the local variables are volatile-qualified. The 'dict' local variable in sfm_open_reader() fits this description but wasn't volatile-qualified. GCC in fact optimized out the changes on my system, and this commit fixes that. --- src/data/sys-file-reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/sys-file-reader.c b/src/data/sys-file-reader.c index e9f63fa0ed..e6fb4c454b 100644 --- a/src/data/sys-file-reader.c +++ b/src/data/sys-file-reader.c @@ -339,7 +339,7 @@ sfm_open_reader (struct file_handle *fh, const char *volatile encoding, struct sfm_extension_record *extensions[32]; - struct dictionary *dict = NULL; + struct dictionary *volatile dict = NULL; size_t i; /* Create and initialize reader. */ -- 2.30.2