<div dir="ltr"><div class="gmail_extra"><span class="gmail-"></span><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">>>> Did you test with valgrind?<br>
><br>
</span><span class="gmail-">> Attached,  is the output of valgrind. Does it make sense?<br>
<br>
</span>No you have to use a binary with debug symbols.<br>
<br>
It may not be necessary to send the output here, I just wanted<br>
to explain that for the kind of error you showed (double free),<br>
a debugger usually cannot help, valgrind (often) does.<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
Carl Eugen<br></div></div></blockquote><div><br></div><div>Sometimes is better to use gcc fsanitize family.<br></div><div><br></div><div><dl compact><dt><code>-fsanitize=address</code></dt><dd><a name="index-fsanitize_003daddress"></a>
<p>Enable AddressSanitizer, a fast memory error detector.
Memory access instructions are instrumented to detect
out-of-bounds and use-after-free bugs.
The option enables <samp>-fsanitize-address-use-after-scope</samp>.
See <a href="https://github.com/google/sanitizers/wiki/AddressSanitizer">https://github.com/google/sanitizers/wiki/AddressSanitizer</a> for
more details.  The run-time behavior can be influenced using the
<code>ASAN_OPTIONS</code> environment variable.  When set to <code>help=1</code>,
the available options are shown at startup of the instrumented program.  See
<a href="https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags">https://github.com/google/sanitizers/wiki/AddressSanitizerFlags#run-time-flags</a>
for a list of supported options.
The option cannot be combined with <samp>-fsanitize=thread</samp>
and/or <samp>-fcheck-pointer-bounds</samp>.
</p>
</dd></dl><p><br></p><p>my 2c</p><p><br></p><p>Mirko<br></p> </div></div></div></div>