From: Guillem Jover Date: Mon, 9 Jun 2008 22:41:59 +0000 (+0300) Subject: libdpkg: Call va_end when done with the va_list variable from va_copy X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3175c4ac2997441375072eb31744ae167b21edd7;p=dpkg 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. --- diff --git a/ChangeLog b/ChangeLog index 5b6987ad..9d59b3ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-06-10 Guillem Jover + + * lib/varbuf.c (varbufvprintf): Call va_end when done with the va_list + variable from va_copy. + 2008-06-10 Guillem Jover * lib/varbuf.c (varbufprintf): Use varbufvprintf instead of diff --git a/lib/varbuf.c b/lib/varbuf.c index 63060c21..ffcc544c 100644 --- a/lib/varbuf.c +++ b/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));