From 3175c4ac2997441375072eb31744ae167b21edd7 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 10 Jun 2008 01:41:59 +0300 Subject: [PATCH] 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. --- ChangeLog | 5 +++++ lib/varbuf.c | 1 + 2 files changed, 6 insertions(+) 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)); -- 2.39.5