<div dir="ltr"> <div class="gmail_extra"><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"><div class="gmail-HOEnZb"><div class="gmail-h5">
> -   if (xmdpy->smapi->destroy)<br>
> -      xmdpy->smapi->destroy(xmdpy-><wbr>smapi);<br>
> -   free(xmdpy->smapi);<br>
> +   if (xmdpy->smapi)<br>
> +   {<br>
> +      if (xmdpy->smapi->destroy)<br>
> +         xmdpy->smapi->destroy(xmdpy-><wbr>smapi);<br>
> +      free(xmdpy->smapi);<br>
> +   }<br>
<br>
</div></div>I don't know this code so I don't know if the patch is right, but just<br>
pointing out this hunk could be written as a simple one-line change:<br>
<span class="gmail-"><br>
-   if (xmdpy->smapi->destroy)<br>
</span>+   if (xmdpy->smapi && xmdpy->smapi->destroy)<span class="gmail-"><br></span></blockquote><div><br></div><div>Combining the two would cause  xmdpy->smapi to leak when the xmdpy->smapi->destroy callback is null.  This way, destroy get's called when it's set but xmdpy->smapi always gets freed.<br><br></div></div>- Chuck<br></div></div>