Package: libsox-fmt-base Version: 14.4.2+git20190427-3+b1 Severity: normal X-Debbugs-Cc: Asher Gordon <asd...@posteo.net>
Dear Maintainer, While attempting to write Perl bindings for libsox, I stumbled upon a memory leak in vorbis.c (two, actually). The memory leak can be seen by something like the following: $ valgrind --leak-check=full --show-leak-kinds=all sox test.ogg test.mp3 $ valgrind --leak-check=full --show-leak-kinds=all sox test.mp3 test.ogg The first line shows the read memory leak and the second shows the write memory leak. The fix is trivial, and I have attached a patch below (created on the upstream code base, but applies cleanly on the Debian version):
From a23816e06a6433d1d553668bb8bd784d5f11d37e Mon Sep 17 00:00:00 2001 From: Asher Gordon <asd...@posteo.net> Date: Sun, 29 Jan 2023 13:08:12 -0500 Subject: [PATCH] vorbis: fix memory leaks Data was allocated in startread() and startwrite() that was not freed in stopread() and stopwrite(). Fix it. --- src/vorbis.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/vorbis.c b/src/vorbis.c index 9fa234ce..ab15301a 100644 --- a/src/vorbis.c +++ b/src/vorbis.c @@ -229,6 +229,7 @@ static int stopread(sox_format_t * ft) free(vb->buf); ov_clear(vb->vf); + free(vb->vf); return (SOX_SUCCESS); } @@ -404,6 +405,7 @@ static int stopwrite(sox_format_t * ft) vorbis_block_clear(&ve->vb); vorbis_dsp_clear(&ve->vd); vorbis_info_clear(&ve->vi); + free(ve); return (SOX_SUCCESS); } -- 2.39.0
Thanks, Asher -- System Information: Debian Release: bookworm/sid APT prefers testing-debug APT policy: (500, 'testing-debug'), (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 6.0.0-6-amd64 (SMP w/2 CPU threads; PREEMPT) Kernel taint flags: TAINT_FIRMWARE_WORKAROUND Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages libsox-fmt-base depends on: ii libc6 2.36-8 ii libflac12 1.4.2+ds-2 ii libgsm1 1.0.22-1 ii libogg0 1.3.5-3 ii libopencore-amrnb0 0.1.6-1 ii libopencore-amrwb0 0.1.6-1 ii libsndfile1 1.2.0-1 ii libsox3 14.4.2+git20190427-3+b1 ii libvorbis0a 1.3.7-1 ii libvorbisenc2 1.3.7-1 ii libvorbisfile3 1.3.7-1 ii libwavpack1 5.6.0-1 libsox-fmt-base recommends no packages. libsox-fmt-base suggests no packages. -- no debconf information -- * Dry-ice can't code his way out of a paper bag <Coderjoe> dry-ice: int main() { ExitPaperBag(); return 0; } <Knghtbrd> Is that how that's done then? *takes notes* -------- I prefer to send and receive mail encrypted. Please send me your public key, and if you do not have my public key, please let me know. Thanks. GPG fingerprint: 38F3 975C D173 4037 B397 8095 D4C9 C4FC 5460 8E68
signature.asc
Description: PGP signature