<div>The scenario is:</div>
<div>struct A *foo()</div>
<div>{</div>
<div> A *a;</div>
<div> </div>
<div> a = malloc(sizeof(A));</div>
<div> if (a == NULL)</div>
<div> return NULL;</div>
<div> </div>
<div> a->b = malloc(sizeof(B));</div>
<div> if (a->b == NULL)</div>
<div> <font color="#ff0000">return NULL;</font></div>
<div> </div>
<div> return a;</div>
<div>}</div>
<div> </div>
<div>There should be "free(a);" before the red line.</div>
<div> </div>
<div>I find that there are many such ommissions in the wayland source tree. The attached txt shows part of them.</div>