<div>Hi,</div>
<div>While looking through the file message.c,</div>
<div>I found that in function omapi_message_destroy()</div>
<div>in the following block</div>
<div> </div>
<div>--cut--</div>
<div><font color="#000000">        m = (omapi_message_object_t *)h;<br>        if (m -> authenticator) {<br>                omapi_typed_data_dereference (&m -> authenticator, file, line);<br>        }<br></font> <font color="#33cc00">       if (!m -> prev && omapi_registered_messages != m)<br>
</font>                omapi_message_unregister (h);<br>--cut--</div>
<div> </div>
<div>omapi message_unregister() for h argument (m has the value of h!) is never processed because it tests the same condition for exiting prematurally (return ISC_R_INVALIDARG):</div>
<div> </div>
<div>--cut--</div>
<div>isc_result_t omapi_message_unregister (omapi_object_t *mo)<br>{<br>        omapi_message_object_t *m;<br>        omapi_message_object_t *n;</div>
<div>        if (mo -> type != omapi_type_message)<br>                return ISC_R_INVALIDARG;<br>        m = (omapi_message_object_t *)mo;</div>
<div>        /* Not registered? */<br>    <font color="#33cc00">    if (!m -> prev && omapi_registered_messages != m)<br></font>                return ISC_R_INVALIDARG;</div>
<div>--cut--<br></div>
<div>I suggest commenting the block in omapi_message_destroy()</div>
<div>like this (leaving omapi_message_unregister() to try it's own test):</div>
<div>
<div> </div>
<div>--cut--</div>
<div><font color="#666666"> </font><font color="#33cc00">       //if (!m -> prev && omapi_registered_messages != m)<br></font>                omapi_message_unregister (h);<br>--cut--</div></div>
<div> </div>
<div>Can you make this change, recompile & run a valgrind test again?</div>
<div> </div>
<div>Regards, </div>
<div>Serghei Samsi</div>
<div> </div>
<div> </div>
<div class="gmail_quote">2011/1/19 Wilson Yang <span dir="ltr"><<a href="mailto:wyang@neoninc.org">wyang@neoninc.org</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div lang="EN-US" vlink="purple" link="blue">
<div>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">Hi,</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8"> </span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">Found a email thread related to memory leak using omapi. Not sure if this has been fixed or a work around is available.</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">Could you please shed some light on this?</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">Appreciate your help in advance.</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8"> </span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">An issue record, </span>[ISC-Bugs #22784]<span style="FONT-SIZE: 10pt; COLOR: #0000c8"> has been created to address this behavior.</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8"> </span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">Here is valgrind output while using v3.1-ESV </span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==2849== 70 (12 direct, 58 indirect) bytes in 1 blocks are definitely lost in loss record 37 of 39</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==2849==    at 0x4022FBA: malloc (vg_replace_malloc.c:236)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==2849==    by 0x804FABF: dmalloc (alloc.c:80)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==2849==    by 0x805066C: omapi_value_new (alloc.c:1025)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==2849==    by 0x8055D10: omapi_generic_set_value (generic.c:160)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==2849==    by 0x805881A: omapi_message_set_value (message.c:160)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==2849==    by 0x8056A35: omapi_set_value (support.c:356)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==2849==    by 0x804CFFF: omapi_protocol_signal_handler (protocol.c:653)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==2849==    by 0x8052C3D: omapi_connection_signal_handler (connection.c:1018)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==2849==    by 0x805566E: omapi_io_signal_handler (dispatch.c:614)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==2849==    by 0x8056976: omapi_signal (support.c:290)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==2849==    by 0x804EBA7: omapi_connection_reader_trace (buffer.c:261)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==2849==    by 0x804E75F: omapi_connection_reader (buffer.c:137)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8"> </span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">And valgrind output while using v4.1-ESV,</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==5828== 70 (12 direct, 58 indirect) bytes in 2 blocks are definitely lost in loss record 39 of 39</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==5828==    at 0x4022FBA: malloc (vg_replace_malloc.c:236)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==5828==    by 0x804F596: dmalloc (alloc.c:75)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==5828==    by 0x804F663: omapi_value_new (alloc.c:1021)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==5828==    by 0x805473D: omapi_generic_set_value (generic.c:157)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==5828==    by 0x805784A: omapi_message_set_value (message.c:162)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==5828==    by 0x804D2DA: omapi_protocol_signal_handler (protocol.c:649)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==5828==    by 0x8055866: omapi_signal (support.c:286)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==5828==    by 0x804EAC3: omapi_connection_reader_trace (buffer.c:265)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==5828==    by 0x80536D2: omapi_one_dispatch (dispatch.c:520)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==5828==    by 0x8053D53: omapi_wait_for_completion (dispatch.c:290)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==5828==    by 0x804AC39: dhcpctl_wait_for_completion (dhcpctl.c:141)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8">==5828==    by 0x8049B7B: main (in /home/user/list_dhclient)</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8"> </span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8"> </span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8; FONT-FAMILY: Consolas">Wilson Yang</span></p>
<p class="MsoNormal"><span style="FONT-SIZE: 10pt; COLOR: #0000c8; FONT-FAMILY: Consolas">720-836-2444</span></p>
<p class="MsoNormal"> </p></div></div><br>_______________________________________________<br>dhcp-users mailing list<br><a href="mailto:dhcp-users@lists.isc.org">dhcp-users@lists.isc.org</a><br><a href="https://lists.isc.org/mailman/listinfo/dhcp-users" target="_blank">https://lists.isc.org/mailman/listinfo/dhcp-users</a><br>
</blockquote></div><br>