Package: ladspa-sdk Version: 1.1-2 Severity: normal Tags: patch
Running valgrind on a program that uses the sine.so plugin in this package produces the following errors: $ valgrind analyseplugin /usr/lib/ladspa/sine.so .... ==10056== Mismatched free() / delete / delete [] ==10056== at 0x1B906E4C: operator delete[](void*) (vg_replace_malloc.c:161) ==10056== by 0x1B90C097: (within /usr/lib/ladspa/sine.so) ==10056== by 0x1B974425: __cxa_finalize (in /lib/tls/libc-2.3.2.so) ==10056== by 0x1B90BC94: (within /usr/lib/ladspa/sine.so) ==10056== by 0x1B90C94B: (within /usr/lib/ladspa/sine.so) ==10056== by 0x1BA5268F: _dl_close (in /lib/tls/libc-2.3.2.so) ==10056== by 0x1B9230AB: (within /lib/tls/libdl-2.3.2.so) ==10056== by 0x1B8F0015: _dl_catch_error (in /lib/ld-2.3.2.so) ==10056== by 0x1B9234A5: (within /lib/tls/libdl-2.3.2.so) ==10056== by 0x1B923071: dlclose (in /lib/tls/libdl-2.3.2.so) ==10056== by 0x804954E: (within /usr/bin/analyseplugin) ==10056== by 0x80492A3: (within /usr/bin/analyseplugin) ==10056== Address 0x1BA91FF8 is 0 bytes inside a block of size 10 alloc'd ==10056== at 0x1B90659D: malloc (vg_replace_malloc.c:130) ==10056== by 0x1B9C108F: strdup (in /lib/tls/libc-2.3.2.so) ==10056== by 0x1B90C31E: StartupShutdownHandler::StartupShutdownHandler() (in /usr/lib/ladspa/sine.so) ==10056== by 0x1B90BD0F: (within /usr/lib/ladspa/sine.so) ==10056== by 0x1B90C0B1: (within /usr/lib/ladspa/sine.so) ==10056== by 0x1B90C928: (within /usr/lib/ladspa/sine.so) ==10056== by 0x1B90BB2C: (within /usr/lib/ladspa/sine.so) ==10056== by 0x1B8F01CD: (within /lib/ld-2.3.2.so) ==10056== by 0x1B8F02B9: _dl_init (in /lib/ld-2.3.2.so) ==10056== by 0x1BA512B1: (within /lib/tls/libc-2.3.2.so) ==10056== by 0x1B8F0015: _dl_catch_error (in /lib/ld-2.3.2.so) ==10056== by 0x1BA50ED5: _dl_open (in /lib/tls/libc-2.3.2.so) (repeated 10 times) ==10056== Mismatched free() / delete / delete [] ==10056== at 0x1B906E4C: operator delete[](void*) (vg_replace_malloc.c:161) ==10056== by 0x1B90C8F6: StartupShutdownHandler::deleteDescriptor(_LADSPA_Descriptor*) (in /usr/lib/ladspa/sine.so) ==10056== by 0x1B90BF3E: (within /usr/lib/ladspa/sine.so) ==10056== by 0x1B974425: __cxa_finalize (in /lib/tls/libc-2.3.2.so) ==10056== by 0x1B90BC94: (within /usr/lib/ladspa/sine.so) ==10056== by 0x1B90C94B: (within /usr/lib/ladspa/sine.so) ==10056== by 0x1BA5268F: _dl_close (in /lib/tls/libc-2.3.2.so) ==10056== by 0x1B9230AB: (within /lib/tls/libdl-2.3.2.so) ==10056== by 0x1B8F0015: _dl_catch_error (in /lib/ld-2.3.2.so) ==10056== by 0x1B9234A5: (within /lib/tls/libdl-2.3.2.so) ==10056== by 0x1B923071: dlclose (in /lib/tls/libdl-2.3.2.so) ==10056== by 0x804954E: (within /usr/bin/analyseplugin) ==10056== Address 0x1BA92670 is 0 bytes inside a block of size 10 alloc'd ==10056== at 0x1B90659D: malloc (vg_replace_malloc.c:130) ==10056== by 0x1B9C108F: strdup (in /lib/tls/libc-2.3.2.so) ==10056== by 0x1B90C2C8: StartupShutdownHandler::StartupShutdownHandler() (in /usr/lib/ladspa/sine.so) ==10056== by 0x1B90BD0F: (within /usr/lib/ladspa/sine.so) ==10056== by 0x1B90C0B1: (within /usr/lib/ladspa/sine.so) ==10056== by 0x1B90C928: (within /usr/lib/ladspa/sine.so) ==10056== by 0x1B90BB2C: (within /usr/lib/ladspa/sine.so) ==10056== by 0x1B8F01CD: (within /lib/ld-2.3.2.so) ==10056== by 0x1B8F02B9: _dl_init (in /lib/ld-2.3.2.so) ==10056== by 0x1BA512B1: (within /lib/tls/libc-2.3.2.so) ==10056== by 0x1B8F0015: _dl_catch_error (in /lib/ld-2.3.2.so) ==10056== by 0x1BA50ED5: _dl_open (in /lib/tls/libc-2.3.2.so) (repeated 10 times) ==10056== ==10056== ERROR SUMMARY: 28 errors from 20 contexts (suppressed: 27 from 1) ==10056== malloc/free: in use at exit: 0 bytes in 0 blocks. ==10056== malloc/free: 60 allocs, 60 frees, 69163 bytes allocated. ==10056== For counts of detected errors, rerun with: -v ==10056== No malloc'd blocks -- no leaks are possible. This is due to the plugin allocating strings with strdup, but freeing them with delete[]. The attached patch fixes this, using free() to free the strings. -- System Information: Debian Release: 3.1 Architecture: i386 (i686) Kernel: Linux 2.6.11.12 Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1) Versions of packages ladspa-sdk depends on: ii libc6 2.3.2.ds1-22 GNU C Library: Shared libraries an ii libgcc1 1:3.4.3-13 GCC support library ii libstdc++5 1:3.3.5-13 The GNU Standard C++ Library v3 -- no debconf information
--- ladspa_sdk/src/plugins/sine.cpp 2002-07-06 18:23:17.000000000 +0100 +++ ladspa_sdk-fix/src/plugins/sine.cpp 2005-12-05 21:14:22.000000000 +0000 @@ -333,13 +333,13 @@ void deleteDescriptor(LADSPA_Descriptor * psDescriptor) { unsigned long lIndex; if (psDescriptor) { - delete [] psDescriptor->Label; - delete [] psDescriptor->Name; - delete [] psDescriptor->Maker; - delete [] psDescriptor->Copyright; + free((char *)psDescriptor->Label); + free((char *)psDescriptor->Name); + free((char *)psDescriptor->Maker); + free((char *)psDescriptor->Copyright); delete [] psDescriptor->PortDescriptors; for (lIndex = 0; lIndex < psDescriptor->PortCount; lIndex++) - delete [] psDescriptor->PortNames[lIndex]; + free((char *)psDescriptor->PortNames[lIndex]); delete [] psDescriptor->PortNames; delete [] psDescriptor->PortRangeHints; delete psDescriptor;