Note that there are some explanatory texts on larger screens.

plurals
  1. POOpenCV free(): invalid pointer:
    primarykey
    data
    text
    <p>I am getting the next error while running an application that reads some data from files, extracts the features of an image and predicts a result using a set of pre-trained classifiers:</p> <pre><code>&gt; *** glibc detected *** ./SVMread: free(): invalid pointer: 0xbfeb2670 *** &gt; ======= Backtrace: ========= /lib/i386-linux-gnu/libc.so.6(+0x75ee2)[0xb5fe8ee2] &gt; /usr/lib/i386-linux-gnu/libstdc++.so.6(_ZdlPv+0x1f)[0xb61e451f] &gt; ./SVMread(_ZN2cv17FlannBasedMatcherD0Ev+0x1c)[0x804b214] &gt; ./SVMread[0x804ca96] ./SVMread[0x804c0e1] &gt; ./SVMread(_ZN2cv3PtrINS_17DescriptorMatcherEED1Ev+0x11)[0x804b6e9] &gt; ./SVMread[0x804a8cc] &gt; /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0xb5f8c4d3] &gt; ./SVMread[0x8049ef1] &gt; ======= Memory map: ======== 08048000-08050000 r-xp 00000000 00:14 101213 /home/srt/OpenCV-2.4.2/samples/cpp/SVMread &gt; 08050000-08051000 r--p 00007000 00:14 101213 &gt; /home/srt/OpenCV-2.4.2/samples/cpp/SVMread 08051000-08052000 rw-p &gt; 00008000 00:14 101213 /home/srt/OpenCV-2.4.2/samples/cpp/SVMread &gt; ... </code></pre> <p>I am thinking that the conflicting part is in one of the next sections of the code, but I really can't find a solution on the web nor in the OpenCV documentation.</p> <pre><code> SurfDescriptorExtractor extractor1; Ptr&lt;DescriptorExtractor&gt; extractor = &amp;extractor1; FlannBasedMatcher matcher1; Ptr&lt;DescriptorMatcher&gt; matcher = &amp;matcher1; BOWImgDescriptorExtractor bowide(extractor,matcher); </code></pre> <p>or in:</p> <pre><code>CvFileStorage* storage = cvOpenFileStorage( "svm1.yml", 0, CV_STORAGE_READ ); const char * c; string clase; CvFileNode* cFN; for (unsigned int i = 0; i&lt;Vclases.size(); i++) { clase = Vclases[i]; c = (clase).c_str(); cFN = cvGetFileNodeByName( storage , 0, c ); cout &lt;&lt; "reading " &lt;&lt; clase &lt;&lt; endl; classes_classifiers[clase].read(storage, cFN ); } </code></pre> <p>Edit: The valgrind output confirms that there is a problem in:</p> <pre><code>CvFileStorage* storage = cvOpenFileStorage( "svm1.yml", 0, CV_STORAGE_READ ); </code></pre> <p>Valgrind:</p> <pre><code>&gt; Conditional jump or move depends on uninitialised value(s) &gt; ==23398== at 0x56585C0: ____strtod_l_internal (strtod_l.c:1659) &gt; ==23398== by 0x5653FAE: strtod (strtod.c:70) &gt; ==23398== by 0x41425B1: icv_strtod(CvFileStorage*, char*, char**) (in /usr/local/lib/libopencv_core.so.2.4.2) &gt; ==23398== by 0x415875F: icvYMLParseValue(CvFileStorage*, char*, CvFileNode*, int, int) (in /usr/local/lib/libopencv_core.so.2.4.2) &gt; ==23398== by 0x804A377: main (SVMread.cpp:64) &gt; ==23398== Uninitialised value was created by a stack allocation &gt; ==23398== at 0x56575E4: ____strtod_l_internal (strtod_l.c:424) </code></pre> <p>I'm a newbie with pointers and memory allocation so any help will be appreciated. Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload