[Xcb] lists, replies, and freeing

Jamey Sharp jamey at minilop.net
Tue May 10 21:23:31 PDT 2005


On Tue, 2005-05-10 at 21:31 -0400, Jeremy Kolb wrote:
> If you have a reply return a list and you free the reply does that free 
> the list is free as well or should that be freed later?

All the memory for a reply, including any lists in that reply, is
allocated in a single malloc call. So you must not free any lists from
replies, and you should free the reply pointer returned by whatever
XCB*Reply function you called.

Would you document this on the Wiki, Jeremy? I bet you can say it better
than I can.

I've long wanted to follow the common C-language convention that the
module that allocates memory should be the one that frees it; but XCB's
callers generally don't have enough information to know how much to
allocate, and I don't see how XCB could ever know when to free.

--Jamey



More information about the xcb mailing list