Quellcode durchsuchen

libdpkg: Call va_end when done with the va_list variable from va_copy

This fixes a memory leak on systems were va_copy needs to allocate
memory.
Guillem Jover vor 18 Jahren
Ursprung
Commit
3175c4ac29
2 geänderte Dateien mit 6 neuen und 0 gelöschten Zeilen
  1. 5 0
      ChangeLog
  2. 1 0
      lib/varbuf.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+2008-06-10  Guillem Jover  <guillem@debian.org>
+
+	* lib/varbuf.c (varbufvprintf): Call va_end when done with the va_list
+	variable from va_copy.
+
 2008-06-10  Guillem Jover  <guillem@debian.org>
 
 	* lib/varbuf.c (varbufprintf): Use varbufvprintf instead of

+ 1 - 0
lib/varbuf.c

@@ -65,6 +65,7 @@ int varbufvprintf(struct varbuf *v, const char *fmt, va_list va) {
     varbufextend(v);
     va_copy(al, va);
     r= vsnprintf(v->buf+ou,v->size-ou,fmt,al);
+    va_end(al);
     if (r < 0) r= (v->size-ou+1) * 2;
     v->used= ou+r;
   } while (r >= (int)(v->size - ou - 1));