[Xcb] Patch to fix memory leak.

Julien Danjou julien at danjou.info
Wed Aug 6 12:48:08 PDT 2008


At 1218051549 time_t, Barton C Massey wrote:
> However, excuse my naivete, but is this the best patch?

That can be discussed for years I think. ;-)

> Wouldn't it have been better to just add the single
> free(rep) line at the end?  Thanks also for any
> clarification you might have.

Yes, it would have been sufficient.

I did that this way by habit, and for the simple reason that next time
we will add a request, we'll get a reply that will need to be freed.
And it will require to spot every return statement in that function and
add many free() just before these statements.

And we all know we can forget to add some free().
Proof: I just fixed one of them. ;-)

(FWIW according to Arnaud's plan, bad synchronous functions like this
one will disappear anyway.)

Cheers,
-- 
Julien Danjou
// ᐰ <julien at danjou.info>   http://julien.danjou.info
// 9A0D 5FD9 EB42 22F6 8974  C95C A462 B51E C2FE E5CD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20080806/5b27e389/attachment-0001.pgp 


More information about the Xcb mailing list