plugged a memory leak, reported by Koen D'Hondt <ripley@xs4all.nl> on 15
authorTim Janik <timj@gtk.org>
Thu, 18 Feb 1999 08:13:19 +0000 (08:13 +0000)
committerTim Janik <timj@src.gnome.org>
Thu, 18 Feb 1999 08:13:19 +0000 (08:13 +0000)
Thu Feb 18 08:24:12 1999  Tim Janik  <timj@gtk.org>

        * gmem.c (g_realloc): plugged a memory leak, reported by Koen D'Hondt
        <ripley@xs4all.nl> on 15 Oct 1998. allocate inital block from realloc.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/gmem.c
gmem.c

index 467999e..037d78e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Feb 18 08:24:12 1999  Tim Janik  <timj@gtk.org>
+
+       * gmem.c (g_realloc): plugged a memory leak, reported by Koen D'Hondt
+       <ripley@xs4all.nl> on 15 Oct 1998. allocate inital block from realloc.
+
 1999-02-17  Elliot Lee  <sopwith@redhat.com>
 
        * glib.spec: Do --enable-debug=no for the .rpm's.
index 467999e..037d78e 100644 (file)
@@ -1,3 +1,8 @@
+Thu Feb 18 08:24:12 1999  Tim Janik  <timj@gtk.org>
+
+       * gmem.c (g_realloc): plugged a memory leak, reported by Koen D'Hondt
+       <ripley@xs4all.nl> on 15 Oct 1998. allocate inital block from realloc.
+
 1999-02-17  Elliot Lee  <sopwith@redhat.com>
 
        * glib.spec: Do --enable-debug=no for the .rpm's.
index 467999e..037d78e 100644 (file)
@@ -1,3 +1,8 @@
+Thu Feb 18 08:24:12 1999  Tim Janik  <timj@gtk.org>
+
+       * gmem.c (g_realloc): plugged a memory leak, reported by Koen D'Hondt
+       <ripley@xs4all.nl> on 15 Oct 1998. allocate inital block from realloc.
+
 1999-02-17  Elliot Lee  <sopwith@redhat.com>
 
        * glib.spec: Do --enable-debug=no for the .rpm's.
index 467999e..037d78e 100644 (file)
@@ -1,3 +1,8 @@
+Thu Feb 18 08:24:12 1999  Tim Janik  <timj@gtk.org>
+
+       * gmem.c (g_realloc): plugged a memory leak, reported by Koen D'Hondt
+       <ripley@xs4all.nl> on 15 Oct 1998. allocate inital block from realloc.
+
 1999-02-17  Elliot Lee  <sopwith@redhat.com>
 
        * glib.spec: Do --enable-debug=no for the .rpm's.
index 467999e..037d78e 100644 (file)
@@ -1,3 +1,8 @@
+Thu Feb 18 08:24:12 1999  Tim Janik  <timj@gtk.org>
+
+       * gmem.c (g_realloc): plugged a memory leak, reported by Koen D'Hondt
+       <ripley@xs4all.nl> on 15 Oct 1998. allocate inital block from realloc.
+
 1999-02-17  Elliot Lee  <sopwith@redhat.com>
 
        * glib.spec: Do --enable-debug=no for the .rpm's.
index 467999e..037d78e 100644 (file)
@@ -1,3 +1,8 @@
+Thu Feb 18 08:24:12 1999  Tim Janik  <timj@gtk.org>
+
+       * gmem.c (g_realloc): plugged a memory leak, reported by Koen D'Hondt
+       <ripley@xs4all.nl> on 15 Oct 1998. allocate inital block from realloc.
+
 1999-02-17  Elliot Lee  <sopwith@redhat.com>
 
        * glib.spec: Do --enable-debug=no for the .rpm's.
index 467999e..037d78e 100644 (file)
@@ -1,3 +1,8 @@
+Thu Feb 18 08:24:12 1999  Tim Janik  <timj@gtk.org>
+
+       * gmem.c (g_realloc): plugged a memory leak, reported by Koen D'Hondt
+       <ripley@xs4all.nl> on 15 Oct 1998. allocate inital block from realloc.
+
 1999-02-17  Elliot Lee  <sopwith@redhat.com>
 
        * glib.spec: Do --enable-debug=no for the .rpm's.
index 467999e..037d78e 100644 (file)
@@ -1,3 +1,8 @@
+Thu Feb 18 08:24:12 1999  Tim Janik  <timj@gtk.org>
+
+       * gmem.c (g_realloc): plugged a memory leak, reported by Koen D'Hondt
+       <ripley@xs4all.nl> on 15 Oct 1998. allocate inital block from realloc.
+
 1999-02-17  Elliot Lee  <sopwith@redhat.com>
 
        * glib.spec: Do --enable-debug=no for the .rpm's.
index e7e215d..a6c3c09 100644 (file)
@@ -285,7 +285,11 @@ g_realloc (gpointer mem,
   
   
   if (size == 0)
-    return NULL;
+    {
+      g_free (mem);
+    
+      return NULL;
+    }
   
   
 #if defined(ENABLE_MEM_PROFILE) || defined(ENABLE_MEM_CHECK)
@@ -298,7 +302,7 @@ g_realloc (gpointer mem,
   
   
   if (!mem)
-    p = (gpointer) malloc (size);
+    p = (gpointer) realloc (NULL, size);
   else
     {
 #if defined(ENABLE_MEM_PROFILE) || defined(ENABLE_MEM_CHECK)
diff --git a/gmem.c b/gmem.c
index e7e215d..a6c3c09 100644 (file)
--- a/gmem.c
+++ b/gmem.c
@@ -285,7 +285,11 @@ g_realloc (gpointer mem,
   
   
   if (size == 0)
-    return NULL;
+    {
+      g_free (mem);
+    
+      return NULL;
+    }
   
   
 #if defined(ENABLE_MEM_PROFILE) || defined(ENABLE_MEM_CHECK)
@@ -298,7 +302,7 @@ g_realloc (gpointer mem,
   
   
   if (!mem)
-    p = (gpointer) malloc (size);
+    p = (gpointer) realloc (NULL, size);
   else
     {
 #if defined(ENABLE_MEM_PROFILE) || defined(ENABLE_MEM_CHECK)