pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src/data dictionary.c [simpler-proc]


From: Ben Pfaff
Subject: [Pspp-cvs] pspp/src/data dictionary.c [simpler-proc]
Date: Sun, 22 Apr 2007 20:26:09 +0000

CVSROOT:        /cvsroot/pspp
Module name:    pspp
Branch:         simpler-proc
Changes by:     Ben Pfaff <blp> 07/04/22 20:26:09

Modified files:
        src/data       : dictionary.c 

Log message:
        Fix leak.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/dictionary.c?cvsroot=pspp&only_with_tag=simpler-proc&r1=1.32.2.1&r2=1.32.2.2

Patches:
Index: dictionary.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/data/dictionary.c,v
retrieving revision 1.32.2.1
retrieving revision 1.32.2.2
diff -u -b -r1.32.2.1 -r1.32.2.2
--- dictionary.c        19 Mar 2007 21:36:24 -0000      1.32.2.1
+++ dictionary.c        22 Apr 2007 20:26:09 -0000      1.32.2.2
@@ -438,11 +438,12 @@
 /* Deletes variable V from dictionary D and frees V.
 
    This is a very bad idea if there might be any pointers to V
-   from outside D.  In general, no variable in should be deleted when
-   any transformations are active on the dictionary's dataset, because
-   those transformations might reference the deleted variable.
-   The safest time to delete a variable is just after a procedure
-   has been executed, as done by MODIFY VARS.
+   from outside D.  In general, no variable in the active file's
+   dictionary should be deleted when any transformations are
+   active on the dictionary's dataset, because those
+   transformations might reference the deleted variable.  The
+   safest time to delete a variable is just after a procedure has
+   been executed, as done by MODIFY VARS.
 
    Pointers to V within D are not a problem, because
    dict_delete_var() knows to remove V from split variables,
@@ -1050,7 +1051,7 @@
   assert (cnt == 0 || split != NULL);
 
   d->split_cnt = cnt;
-  d->split = xnrealloc (d->split, cnt, sizeof *d->split);
+  d->split = cnt > 0 ? xnrealloc (d->split, cnt, sizeof *d->split) : NULL;
   memcpy (d->split, split, cnt * sizeof *d->split);
 
   if ( d->callbacks &&  d->callbacks->split_changed )




reply via email to

[Prev in Thread] Current Thread [Next in Thread]