From: Ben Pfaff <blp@cs.stanford.edu> Date: Mon, 20 Aug 2012 06:59:47 +0000 (-0700) Subject: sys-file-reader: Fix memory leak. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d4d8b75297c30d7c95c2ab753f2c4493ae221ee;p=pspp 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. --- 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. */