pspp-cvs
[Top][All Lists]
Advanced

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

[Pspp-cvs] pspp/src data/file-name.c data/format.c libpspp...


From: John Darrington
Subject: [Pspp-cvs] pspp/src data/file-name.c data/format.c libpspp...
Date: Tue, 14 Nov 2006 11:47:18 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   06/11/14 11:47:17

Modified files:
        src/data       : file-name.c format.c 
        src/libpspp    : pool.c 
        src/ui         : flexifile.c 
        src/ui/terminal: main.c read-line.c 

Log message:
        Plugged some small memory leaks

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/file-name.c?cvsroot=pspp&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/format.c?cvsroot=pspp&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/pool.c?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/flexifile.c?cvsroot=pspp&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/terminal/main.c?cvsroot=pspp&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/terminal/read-line.c?cvsroot=pspp&r1=1.8&r2=1.9

Patches:
Index: data/file-name.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/file-name.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- data/file-name.c    14 Oct 2006 00:25:20 -0000      1.6
+++ data/file-name.c    14 Nov 2006 11:47:17 -0000      1.7
@@ -146,7 +146,7 @@
           pwd = getpwnam (ds_cstr (&user_name));
           if (pwd != NULL && pwd->pw_dir[0] != '\0')
             {
-              home = pwd->pw_dir;
+              home = xstrdup (pwd->pw_dir);
               remainder = input + 1 + ds_length (&user_name);
             }
           ds_destroy (&user_name);

Index: data/format.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/format.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- data/format.c       5 Nov 2006 05:20:53 -0000       1.12
+++ data/format.c       14 Nov 2006 11:47:17 -0000      1.13
@@ -60,10 +60,15 @@
     }
 }
 
+static struct fmt_number_style *styles[FMT_NUMBER_OF_FORMATS];
+
 /* Deinitialize the format module. */
 void
 fmt_done (void)
 {
+  int t;
+  for (t = 0 ; t < FMT_NUMBER_OF_FORMATS ; ++t )
+         fmt_number_style_destroy (styles[t]);
 }
 
 /* Returns an input format specification with type TYPE, width W,
@@ -745,7 +750,6 @@
   return map[bytes - 1];
 }
 
-static struct fmt_number_style *styles[FMT_NUMBER_OF_FORMATS];
 
 /* Creates and returns a new struct fmt_number_style,
    initializing all affixes to empty strings. */

Index: libpspp/pool.c
===================================================================
RCS file: /sources/pspp/pspp/src/libpspp/pool.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- libpspp/pool.c      14 Oct 2006 00:25:21 -0000      1.5
+++ libpspp/pool.c      14 Nov 2006 11:47:17 -0000      1.6
@@ -700,8 +700,8 @@
 
   assert (pool && file_name && mode);
   f = fopen (file_name, mode);
-  if (f == NULL)
-    return NULL;
+  if (f != NULL)
+    pool_attach_file (pool, f);
 
   return f;
 }

Index: ui/flexifile.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/flexifile.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- ui/flexifile.c      25 Sep 2006 09:35:15 -0000      1.2
+++ ui/flexifile.c      14 Nov 2006 11:47:17 -0000      1.3
@@ -25,6 +25,7 @@
 #include <data/casefile.h>
 #include <data/casefile-private.h>
 #include <data/case.h>
+#include <libpspp/compiler.h>
 
 
 struct class_flexifile

Index: ui/terminal/main.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/terminal/main.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- ui/terminal/main.c  11 Nov 2006 23:10:01 -0000      1.20
+++ ui/terminal/main.c  14 Nov 2006 11:47:17 -0000      1.21
@@ -194,6 +194,7 @@
 
       outp_done ();
       msg_ui_done ();
+      fmt_done ();
     }
   exit (success ? EXIT_SUCCESS : EXIT_FAILURE);
 }

Index: ui/terminal/read-line.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/terminal/read-line.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- ui/terminal/read-line.c     28 Jun 2006 05:49:03 -0000      1.8
+++ ui/terminal/read-line.c     14 Nov 2006 11:47:17 -0000      1.9
@@ -83,6 +83,8 @@
 #if HAVE_READLINE && unix
   if (history_file != NULL)
     write_history (history_file);
+  clear_history ();
+  free (history_file);
 #endif
 }
 
@@ -157,7 +159,7 @@
 #endif
 }
 
-#ifdef HAVE_READLINE
+#if HAVE_READLINE
 static char *command_generator (const char *text, int state);
 
 /* Returns a set of command name completions for TEXT.




reply via email to

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