From: Ben Pfaff Date: Sun, 30 Jan 2011 23:33:30 +0000 (-0800) Subject: sys-file-reader: Fix double-free on read of partial record. X-Git-Tag: v0.7.7~90 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f994fab43f6aeb00cfb40d24c4c4c6ed518a05b9;p=pspp-builds.git sys-file-reader: Fix double-free on read of partial record. partial_record() does a longjmp() to code near the top of sys_file_casereader_read() that unrefs the case, but this code at the end of sys_file_casereader_read() would have already unref'ed it once in that case, resulting in a double-free. --- diff --git a/src/data/sys-file-reader.c b/src/data/sys-file-reader.c index c9c843df..aff21d60 100644 --- a/src/data/sys-file-reader.c +++ b/src/data/sys-file-reader.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1766,11 +1766,11 @@ sys_file_casereader_read (struct casereader *reader, void *r_) return c; eof: - case_unref (c); if (i != 0) partial_record (r); if (r->case_cnt != -1) read_error (reader, r); + case_unref (c); return NULL; }