From 1afbfdb8bad18bad0df555a1a19525ec47f00c0d Mon Sep 17 00:00:00 2001 From: Tim Terriberry Date: Fri, 4 Nov 2011 23:55:47 +0000 Subject: [PATCH] Fix a memory leak in vorbis_commentheader_out(). Fixes #1840. Thanks to Alexandru Munteanu for the patch. svn path=/trunk/vorbis/; revision=18115 --- lib/info.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/info.c b/lib/info.c index 7ca3ea8..76347ef 100644 --- a/lib/info.c +++ b/lib/info.c @@ -550,7 +550,10 @@ int vorbis_commentheader_out(vorbis_comment *vc, oggpack_buffer opb; oggpack_writeinit(&opb); - if(_vorbis_pack_comment(&opb,vc)) return OV_EIMPL; + if(_vorbis_pack_comment(&opb,vc)){ + oggpack_writeclear(&opb); + return OV_EIMPL; + } op->packet = _ogg_malloc(oggpack_bytes(&opb)); memcpy(op->packet, opb.buffer, oggpack_bytes(&opb)); @@ -561,6 +564,7 @@ int vorbis_commentheader_out(vorbis_comment *vc, op->granulepos=0; op->packetno=1; + oggpack_writeclear(&opb); return 0; } -- 2.7.4