Commit 65ef80b fixed building with xcb-util >= 0.3.8, but the reply is never
checked (possible SIGSEGV if the reply is NULL) nor freed (memory leak at each
call of the functions).
Also, remove include and dependencies on xcb-atom, as it was only meaningful
for xcb_atom_get() and STRING, and depend instead on xcb >= 1.6 for
XCB_ATOM_STRING.
[x11=auto])
if test "x${x11}" != xno ; then
[x11=auto])
if test "x${x11}" != xno ; then
- PKG_CHECK_MODULES(X11, [ x11-xcb ice sm xtst xcb-atom ],
+ PKG_CHECK_MODULES(X11, [ x11-xcb xcb >= 1.6 ice sm xtst ],
#include <pulsecore/macro.h>
#include <xcb/xproto.h>
#include <pulsecore/macro.h>
#include <xcb/xproto.h>
-#include <xcb/xcb_atom.h>
void pa_x11_set_prop(xcb_connection_t *xcb, int screen, const char *name, const char *data) {
xcb_screen_t *xs;
void pa_x11_set_prop(xcb_connection_t *xcb, int screen, const char *name, const char *data) {
xcb_screen_t *xs;
- xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
pa_assert(xcb);
xcb_intern_atom_reply_t *reply;
pa_assert(xcb);
pa_assert(data);
if ((xs = screen_of_display(xcb, screen))) {
pa_assert(data);
if ((xs = screen_of_display(xcb, screen))) {
- cookie = xcb_intern_atom(xcb, 0, strlen(name), name);
- reply = xcb_intern_atom_reply(xcb, cookie, NULL);
+ reply = xcb_intern_atom_reply(xcb,
+ xcb_intern_atom(xcb, 0, strlen(name), name),
+ NULL);
- xcb_change_property(xcb, XCB_PROP_MODE_REPLACE, xs->root, reply->atom, XCB_ATOM_STRING, PA_XCB_FORMAT, (int) strlen(data), (const void*) data);
+ if (reply) {
+ xcb_change_property(xcb, XCB_PROP_MODE_REPLACE, xs->root, reply->atom,
+ XCB_ATOM_STRING, PA_XCB_FORMAT,
+ (int) strlen(data), (const void*) data);
+
+ free(reply);
+ }
}
}
void pa_x11_del_prop(xcb_connection_t *xcb, int screen, const char *name) {
xcb_screen_t *xs;
}
}
void pa_x11_del_prop(xcb_connection_t *xcb, int screen, const char *name) {
xcb_screen_t *xs;
- xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
pa_assert(xcb);
pa_assert(name);
if ((xs = screen_of_display(xcb, screen))) {
xcb_intern_atom_reply_t *reply;
pa_assert(xcb);
pa_assert(name);
if ((xs = screen_of_display(xcb, screen))) {
- cookie = xcb_intern_atom(xcb, 0, strlen(name), name);
- reply = xcb_intern_atom_reply(xcb, cookie, NULL);
-
- xcb_delete_property(xcb, xs->root, reply->atom);
+ reply = xcb_intern_atom_reply(xcb,
+ xcb_intern_atom(xcb, 0, strlen(name), name),
+ NULL);
+
+ if (reply) {
+ xcb_delete_property(xcb, xs->root, reply->atom);
+ free(reply);
+ }
xcb_get_property_cookie_t req;
xcb_get_property_reply_t* prop = NULL;
xcb_screen_t *xs;
xcb_get_property_cookie_t req;
xcb_get_property_reply_t* prop = NULL;
xcb_screen_t *xs;
- xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
pa_assert(xcb);
xcb_intern_atom_reply_t *reply;
pa_assert(xcb);
xs = screen_of_display(xcb, 0);
if (xs) {
xs = screen_of_display(xcb, 0);
if (xs) {
- cookie = xcb_intern_atom(xcb, 0, strlen(name), name);
- reply = xcb_intern_atom_reply(xcb, cookie, NULL);
+ reply = xcb_intern_atom_reply(xcb,
+ xcb_intern_atom(xcb, 0, strlen(name), name),
+ NULL);
+
+ if (!reply)
+ goto finish;
req = xcb_get_property(xcb, 0, xs->root, reply->atom, XCB_ATOM_STRING, 0, (uint32_t)(l-1));
req = xcb_get_property(xcb, 0, xs->root, reply->atom, XCB_ATOM_STRING, 0, (uint32_t)(l-1));
prop = xcb_get_property_reply(xcb, req, NULL);
if (!prop)
prop = xcb_get_property_reply(xcb, req, NULL);
if (!prop)