[Kde-imaging] memory leak in libksane...

Kåre Särs kare.sars at iki.fi
Sun Oct 11 22:13:05 CEST 2009


On Saturday 10 October 2009 14:57:00 Gilles Caulier wrote:
> Kare,
> 
> Look valgrind report with current code from trunk, when Acquire Image
> plugin is open from digiKam :
> 
Thanks Gilles for the valgrind report. I definitely should run Valgrind a 
little more often :)

> ==11340== Conditional jump or move depends on uninitialised value(s)
> KSaneIface::KSaneWidgetPrivate::updatePreviewSize()
> (ksane_widget_private.cpp:561)
Fixed

> ==11340== Conditional jump or move depends on uninitialised value(s)
> KSaneIface::KSaneOptFSlider::sliderChanged(float)
> (ksane_opt_fslider.cpp:126)
Fixed

> ==11340== Conditional jump or move depends on uninitialised value(s)
> ==11340==    at 0x13B48F58: KSaneIface::SelectionItem::boundingRect()
> const (selectionitem.cpp:218)
> const (selectionitem.cpp:221)
> const (selectionitem.cpp:225)
> const (selectionitem.cpp:229)
Fixed (only one variable was uninitialized)


I should probably report some of these memory leak findings forward to the 
sane-devel list. I think the only one that belonged to libksane was the one in 
KSaneDeviceDialog.

> ==11340==    at 0x4022DC2: calloc (vg_replace_malloc.c:397)
> ==11340==    by 0x162F118C: sane_cardscan_get_devices (in
> /usr/lib/sane/libsane-cardscan.so.1.0.19)

> ==11340==    by 0x136DE36E: sane_dll_get_devices (in
> /usr/lib/libsane.so.1.0.19)
> ==11340==    by 0x136DEFB2: sane_get_devices (in
> /usr/lib/libsane.so.1.0.19)
> ==11340==    by 0x685D4DE: (within /usr/lib/libQtCore.so.4.5.0)
> ==11340==    by 0x6C8A25D: clone (in /lib/i686/libc-2.9.so)
> ==11340==
> ==11340==
> ==11340== 4 bytes in 1 blocks are definitely lost in loss record 4 of
> 643
> ==11340==    at 0x4022DC2: calloc (vg_replace_malloc.c:397)
> ==11340==    by 0x162834DC: (within
> /usr/lib/sane/libsane-fujitsu.so.1.0.19)
> ==11340==    by 0x16283980: sane_fujitsu_get_devices (in
> /usr/lib/sane/libsane-fujitsu.so.1.0.19)
> ==11340==    by 0x136DE36E: sane_dll_get_devices (in
> /usr/lib/libsane.so.1.0.19)
> ==11340==    by 0x136DEFB2: sane_get_devices (in
> /usr/lib/libsane.so.1.0.19)
> ==11340==    by 0x685D4DE: (within /usr/lib/libQtCore.so.4.5.0)
> ==11340==    by 0x6C8A25D: clone (in /lib/i686/libc-2.9.so)
> ==11340==
> ...
> ==11340==
> ==11340== 196 (8 direct, 188 indirect) bytes in 1 blocks are
> definitely lost in loss record 181 of 643
> ==11340==    at 0x402471E: operator new(unsigned int)
> (vg_replace_malloc.c:224)
> ==11340==    by 0x13B4B096:
> KSaneIface::KSaneDeviceDialog::KSaneDeviceDialog(QWidget*)
> (ksane_device_dialog.cpp:57)
> ==11340==    by 0x13B4F40F:
> KSaneIface::KSaneWidget::selectDevice(QWidget*) (ksane_widget.cpp:219)
> ==11340==    by 0x1385309E: Plugin_AcquireImages::slotActivate()
> (plugin_acquireimages.cpp:104)
> ==11340==    by 0x13853C80:
> Plugin_AcquireImages::qt_metacall(QMetaObject::Call, int, void**)
> (plugin_acquireimages.moc:68)
> ==11340==    by 0x696FE44: QMetaObject::activate(QObject*, int, int,
> void**) (in /usr/lib/libQtCore.so.4.5.0)
> ==11340==    by 0x69702AA: QMetaObject::activate(QObject*, QMetaObject
> const*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.0)
> ==11340==    by 0xBECA5B63: ???
> ==11340==
> ...
> ==11340==
> ==11340==
> ==11340== 15 bytes in 1 blocks are definitely lost in loss record 217
> of 643
> ==11340==    at 0x4024D0E: malloc (vg_replace_malloc.c:207)
> ==11340==    by 0x15347EA2: (within
> /usr/lib/sane/libsane-epkowa.so.1.0.15)
> ==11340==    by 0x15348D14: (within
> /usr/lib/sane/libsane-epkowa.so.1.0.15)
> ==11340==    by 0x1534931A: (within
> /usr/lib/sane/libsane-epkowa.so.1.0.15)
> ==11340==    by 0x15349671: (within
> /usr/lib/sane/libsane-epkowa.so.1.0.15)
> ==11340==    by 0x1534189E: (within
> /usr/lib/sane/libsane-epkowa.so.1.0.15)
> ==11340==    by 0x15340D26: (within
> /usr/lib/sane/libsane-epkowa.so.1.0.15)
> ==11340==    by 0x15340F43: (within
> /usr/lib/sane/libsane-epkowa.so.1.0.15)
> ==11340==    by 0x15345A97: (within
> /usr/lib/sane/libsane-epkowa.so.1.0.15)
> ==11340==    by 0x15341AC9: (within
> /usr/lib/sane/libsane-epkowa.so.1.0.15)
> ==11340==    by 0x15340F43: (within
> /usr/lib/sane/libsane-epkowa.so.1.0.15)
> ==11340==    by 0x153410F0: sane_epkowa_init (in
> /usr/lib/sane/libsane-epkowa.so.1.0.15)
> ==11340==
> ==11340==
> ==11340== 18 bytes in 2 blocks are definitely lost in loss record 244
> of 643
> ==11340==    at 0x4024D0E: malloc (vg_replace_malloc.c:207)
> ==11340==    by 0x6C20DB8: strndup (in /lib/i686/libc-2.9.so)
> ==11340==    by 0x1613EBDB: sanei_config_get_string (in
> /usr/lib/sane/libsane-hp5400.so.1.0.19)
> ==11340==    by 0x6E69776E: ???
> ==11340==
> ...
> ==11340== 24 bytes in 1 blocks are definitely lost in loss record 290
> of 643
> ==11340==    at 0x4024D0E: malloc (vg_replace_malloc.c:207)
> ==11340==    by 0x16205EE6: sanei_scsi_open_extended (in
> /usr/lib/sane/libsane-hp.so.1.0.19)
> ==11340==    by 0x3167732E: ???
> ==11340==
> ==11340==
> ==11340== 32 bytes in 2 blocks are definitely lost in loss record 319
> of 643
> ==11340==    at 0x4024D0E: malloc (vg_replace_malloc.c:207)
> ==11340==    by 0x16128921: sane_hp5590_get_devices (in
> /usr/lib/sane/libsane-hp5590.so.1.0.19)
> ==11340==    by 0x136DE36E: sane_dll_get_devices (in
> /usr/lib/libsane.so.1.0.19)
> ==11340==    by 0x136DEFB2: sane_get_devices (in
> /usr/lib/libsane.so.1.0.19)
> ==11340==    by 0x685D4DE: (within /usr/lib/libQtCore.so.4.5.0)
> ==11340==    by 0x6C8A25D: clone (in /lib/i686/libc-2.9.so)
> ...
> ==11340==
> ==11340== 208 (192 direct, 16 indirect) bytes in 1 blocks are
> definitely lost in loss record 445 of 643
> ==11340==    at 0x402471E: operator new(unsigned int)
> (vg_replace_malloc.c:224)
> ==11340==    by 0x5C69649:
> QBoxLayout::QBoxLayout(QBoxLayout::Direction, QWidget*) (in
> /usr/lib/libQtGui.so.4.5.0)
> ==11340==    by 0x13B4F40F:
> KSaneIface::KSaneWidget::selectDevice(QWidget*) (ksane_widget.cpp:219)
> ==11340==    by 0x1385309E: Plugin_AcquireImages::slotActivate()
> (plugin_acquireimages.cpp:104)
> ==11340==    by 0x13853C80:
> Plugin_AcquireImages::qt_metacall(QMetaObject::Call, int, void**)
> (plugin_acquireimages.moc:68)
> ==11340==    by 0x696FE44: QMetaObject::activate(QObject*, int, int,
> void**) (in /usr/lib/libQtCore.so.4.5.0)
> ==11340==    by 0x69702AA: QMetaObject::activate(QObject*, QMetaObject
> const*, int, int, void**) (in /usr/lib/libQtCore.so.4.5.0)
> ==11340==    by 0xBECA5B63: ???
> ...
> ==11340==
> ==11340== 256 bytes in 1 blocks are definitely lost in loss record 458
> of 643
> ==11340==    at 0x4024D0E: malloc (vg_replace_malloc.c:207)
> ==11340==    by 0x1533F28B: (within
> /usr/lib/sane/libsane-epkowa.so.1.0.15)
> ==11340==    by 0x15340F43: (within
> /usr/lib/sane/libsane-epkowa.so.1.0.15)
> ==11340==    by 0x153410F0: sane_epkowa_init (in
> /usr/lib/sane/libsane-epkowa.so.1.0.15)
> ==11340==    by 0x136DE03D: (within /usr/lib/libsane.so.1.0.19)
> ==11340==    by 0x685D4DE: (within /usr/lib/libQtCore.so.4.5.0)
> ==11340==    by 0x6C8A25D: clone (in /lib/i686/libc-2.9.so)
> ...
> ==11340==
> ==11340== 918 bytes in 66 blocks are definitely lost in loss record
> 526 of 643
> ==11340==    at 0x4024D0E: malloc (vg_replace_malloc.c:207)
> ==11340==    by 0x6C20D4F: strdup (in /lib/i686/libc-2.9.so)
> ==11340==    by 0x136DDF86: (within /usr/lib/libsane.so.1.0.19)
> ==11340==    by 0x136DE006: (within /usr/lib/libsane.so.1.0.19)
> ==11340==    by 0x136DE350: sane_dll_get_devices (in
> /usr/lib/libsane.so.1.0.19)
> ==11340==    by 0x136DEFB2: sane_get_devices (in
> /usr/lib/libsane.so.1.0.19)
> ==11340==    by 0x685D4DE: (within /usr/lib/libQtCore.so.4.5.0)
> ==11340==    by 0x6C8A25D: clone (in /lib/i686/libc-2.9.so)
> ...
> ==11340== 1,460,632 bytes in 4,392 blocks are possibly lost in loss
> record 642 of 643
> ==11340==    at 0x4024D0E: malloc (vg_replace_malloc.c:207)
> ==11340==    by 0xBCB9196: (within /usr/lib/libsqlite3.so.0.8.6)
> ==11340==    by 0xFF09FFFF: ???
> ==11340==
> ==11340== LEAK SUMMARY:
> ==11340==    definitely lost: 4,089 bytes in 122 blocks.
> ==11340==    indirectly lost: 4,752 bytes in 231 blocks.
> ==11340==      possibly lost: 1,824,360 bytes in 6,204 blocks.
> ==11340==    still reachable: 6,163,645 bytes in 35,163 blocks.
> ==11340==         suppressed: 0 bytes in 0 blocks.
> ==11340== Reachable blocks (those to which a pointer was found) are not
>  shown. ==11340== To see them, rerun with: --leak-check=full
>  --show-reachable=yes _______________________________________________

-- 
Kåre Särs


More information about the Kde-imaging mailing list