Fix possible memory corruption (FS#734)
commit612616aee64983f0c530dc951fcfc1356f0ab51f
authorAri Entlich <atrigent@ccs.neu.edu>
Mon, 22 Mar 2010 13:17:27 +0000 (22 14:17 +0100)
committerJulien Danjou <julien@danjou.info>
Mon, 22 Mar 2010 13:19:30 +0000 (22 14:19 +0100)
tree29e2d5284ccdcb140cd3d9a75dc4ff8a2ec89c3b
parent38435bb3207506a92c25a8c99945fcee14b3217f
Fix possible memory corruption (FS#734)

The memory referred to by the reply argument of
property_update_wm_protocols is automatically free'd
by xcb later on, so it is not safe to simply use the
value of reply in our own data structures. If we did
this, future calls to xcb_get_wm_protocols_reply_wipe
free the data which has already been free'd by xcb,
causing a double-free and corrupting the heap. In
addition, it isn't safe to use free'd memory as if
it is still allocated. Instead, duplicate the data
referred to by reply and use the duplicate instead.

It seems to me as if the duplication should actually
be done in xcb_get_wm_protocols_from_reply, but I'm
not really sure. If that is the case, this is simply
a work-around until xcb can be fixed.

Signed-off-by: Ari Entlich <atrigent@ccs.neu.edu>
Signed-off-by: Julien Danjou <julien@danjou.info>
property.c