← Back to team overview

cuneiform team mailing list archive

[Bug 654776] [NEW] Memory leak in pagetree.cpp

 

Public bug reported:

valgrind reports the following memory leak in cuneiform library.

Code fragment:
...
    SETUP_GENERATE_TREE setup;
    Inf.Tree.Root = (KNOTT*)malloc(sizeof(KNOTT));
    KNOTT *pRoot=Inf.Tree.Root,*ptr,*ptr1,*ptr2;
...

After my brief review I have found out that Inf.Tree.Root may not be fee()'ed if:
* "alDebug" is defined, and OpenFullOutTiger(InFileName) returns false.
* FlagBadBad is set to true in line 1901.

==29705== 18,386 bytes in 317 blocks are definitely lost in loss record 208 of 209
==29705==    at 0x4823C4C: malloc (vg_replace_malloc.c:195)
==29705==    by 0x51B226F: PageTree (pagetree.cpp:1845)
==29705==    by 0x518D472: CRtfPage::FindPageTree(_IO_FILE*, char const*) (creatertf.cpp:675)
==29705==    by 0x518BD1C: FullRtf (creatertf.cpp:150)
==29705==    by 0x51A1C39: RFRMT_Formatter (frmt.cpp:224)
==29705==    by 0x522A307: Recognize() (partrecog.cpp:825)
==29705==    by 0x522B83B: PUMA_XFinalRecognition (puma.cpp:594)
==29705==    by 0x18D91C: get_atom_label(Magick::Image const&, Magick::ColorGray const&, int, int, int, int, double, int, int) (osra_ocr.cpp:277)

Additional info:
Sources: http://ftp.de.debian.org/debian/pool/non-free/c/cuneiform/cuneiform_1.0.0+dfsg.orig.tar.bz2
osra_ocr.cpp: http://osra.svn.sourceforge.net/viewvc/osra/trunk/src/osra_ocr.cpp?revision=597&view=markup

** Affects: cuneiform-linux
     Importance: Undecided
         Status: New

-- 
Memory leak in pagetree.cpp
https://bugs.launchpad.net/bugs/654776
You received this bug notification because you are a member of Cuneiform
Linux, which is the registrant for Cuneiform for Linux.

Status in Linux port of Cuneiform: New

Bug description:
valgrind reports the following memory leak in cuneiform library.

Code fragment:
...
    SETUP_GENERATE_TREE setup;
    Inf.Tree.Root = (KNOTT*)malloc(sizeof(KNOTT));
    KNOTT *pRoot=Inf.Tree.Root,*ptr,*ptr1,*ptr2;
...

After my brief review I have found out that Inf.Tree.Root may not be fee()'ed if:
* "alDebug" is defined, and OpenFullOutTiger(InFileName) returns false.
* FlagBadBad is set to true in line 1901.

==29705== 18,386 bytes in 317 blocks are definitely lost in loss record 208 of 209
==29705==    at 0x4823C4C: malloc (vg_replace_malloc.c:195)
==29705==    by 0x51B226F: PageTree (pagetree.cpp:1845)
==29705==    by 0x518D472: CRtfPage::FindPageTree(_IO_FILE*, char const*) (creatertf.cpp:675)
==29705==    by 0x518BD1C: FullRtf (creatertf.cpp:150)
==29705==    by 0x51A1C39: RFRMT_Formatter (frmt.cpp:224)
==29705==    by 0x522A307: Recognize() (partrecog.cpp:825)
==29705==    by 0x522B83B: PUMA_XFinalRecognition (puma.cpp:594)
==29705==    by 0x18D91C: get_atom_label(Magick::Image const&, Magick::ColorGray const&, int, int, int, int, double, int, int) (osra_ocr.cpp:277)

Additional info:
Sources: http://ftp.de.debian.org/debian/pool/non-free/c/cuneiform/cuneiform_1.0.0+dfsg.orig.tar.bz2
osra_ocr.cpp: http://osra.svn.sourceforge.net/viewvc/osra/trunk/src/osra_ocr.cpp?revision=597&view=markup





Follow ups

References