title: Valgrind memcheck result analysis of a bison/flex parser
body: <p>I am running memcheck on my program and i'm trying to solve the memory issues.</p>
  
  <p>Memcheck output :  </p>
  
  <pre><code>==29633== 3,443 (128 direct, 3,315 indirect) bytes in 2 blocks are definitely lost in loss record 7 of 8
  ==29633==    at 0x4A07D2E: operator new(unsigned long) (vg_replace_malloc.c:261)
  ==29633==    by 0x42027F: PDcbk(cpfrCallbackType_e, Powerdomain*) (NetExtractor.cpp:1243)
  ==29633==    by 0x413DBA: cpfparse() (cpf.y:120)
  ==29633==    by 0x42039B: loadCPF(char*) (NetExtractor.cpp:1253)
  ==29633==    by 0x420E5D: main (NetExtractor.cpp:1399)
  ==29633== LEAK SUMMARY:
  ==29633==    definitely lost: 128 bytes in 2 blocks
  ==29633==    indirectly lost: 3,315 bytes in 10 blocks
  ==29633==      possibly lost: 0 bytes in 0 blocks
  ==29633==    still reachable: 16,458 bytes in 3 blocks
  ==29633==         suppressed: 0 bytes in 0 blocks
  </code></pre>
  
  <p>Line 1253 of NetExtractor is :  </p>
  
  <pre><code>powerdomainMap.insert(Powerdomain_pair(powerdomain-&gt;getName(),new Powerdomain(*powerdomain)));
  </code></pre>
  
  <p>Info to understand the code :   </p>
  
  <pre><code>PowerdomainHashMap powerdomainMap;
  
  typedef hash_map&lt;const string, Powerdomain*, strptrhash, strptrequal&gt; PowerdomainHashMap;
  typedef pair&lt;const string, Powerdomain*&gt; Powerdomain_pair;
  </code></pre>
  
  <p>For now my guess is that there isn't really a leak because i still can access the newly created powerdomain from my hashmap and that valgrind isn't able to see that.</p>
  
  <p>Am I right ? If not can someone explain me ?</p>
  
  <p>Thanks and feel free to ask code details as i only pasted what i thought was relevant but i might have missed something.</p>