OSSP CVS Repository

ossp - Check-in [5012]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 5012
Date: 2005-Feb-03 11:32:08 (local)
2005-Feb-03 10:32:08 (UTC)
User:rse
Branch:
Comment: Plug a memory leak in cfg_fmt.c's cfg_fmt_vasprintf() in case a formatting error occurs.
Tickets:
Inspections:
Files:
ossp-pkg/cfg/ChangeLog      1.32 -> 1.33     6 inserted, 0 deleted
ossp-pkg/cfg/cfg_fmt.c      1.8 -> 1.9     3 inserted, 1 deleted

ossp-pkg/cfg/ChangeLog 1.32 -> 1.33

--- ChangeLog    2005/01/24 14:25:21     1.32
+++ ChangeLog    2005/02/03 10:32:08     1.33
@@ -8,6 +8,12 @@
 
   CHANGELOG
 
+ Changes between 0.9.8 and 0.9.9 (24-Jan-2005 to xx-Feb-2005):
+
+   *) Plug a memory leak in cfg_fmt.c's cfg_fmt_vasprintf()
+      in case a formatting error occurs.
+      [Ralf S. Engelschall <rse@engelschall.com>]
+
  Changes between 0.9.7 and 0.9.8 (19-Dec-2004 to 24-Jan-2005):
 
    *) Remove debugging fprintf's from (still broken) cfg_node_select() function.


ossp-pkg/cfg/cfg_fmt.c 1.8 -> 1.9

--- cfg_fmt.c    2005/01/24 14:18:48     1.8
+++ cfg_fmt.c    2005/02/03 10:32:08     1.9
@@ -1157,8 +1157,10 @@
     if ((s = malloc(rv+1)) == NULL)
         return NULL;
     va_copy(ap, apbak);
-    if ((rv = cfg_fmt_vsprintf(s, rv+1, fmt, ap)) == -1)
+    if ((rv = cfg_fmt_vsprintf(s, rv+1, fmt, ap)) == -1) {
+        free(s);
         return NULL;
+    }
     return s;
 }
 

CVSTrac 2.0.1