Bugfix: Don’t free xinerama-reply if it is NULL, implement FREE()-macro (Thanks Igor)
This commit is contained in:
parent
3164bb7afa
commit
fcc5ce516b
@ -24,6 +24,13 @@
|
|||||||
#define FOR_TABLE(workspace) \
|
#define FOR_TABLE(workspace) \
|
||||||
for (int cols = 0; cols < workspace->cols; cols++) \
|
for (int cols = 0; cols < workspace->cols; cols++) \
|
||||||
for (int rows = 0; rows < workspace->rows; rows++)
|
for (int rows = 0; rows < workspace->rows; rows++)
|
||||||
|
#define FREE(pointer) do { \
|
||||||
|
if (pointer == NULL) { \
|
||||||
|
free(pointer); \
|
||||||
|
pointer = NULL; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
while (0)
|
||||||
|
|
||||||
/* ##__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that is,
|
/* ##__VA_ARGS__ means: leave out __VA_ARGS__ completely if it is empty, that is,
|
||||||
delete the preceding comma */
|
delete the preceding comma */
|
||||||
|
@ -206,14 +206,14 @@ void initialize_xinerama(xcb_connection_t *conn) {
|
|||||||
xcb_xinerama_is_active_reply_t *reply;
|
xcb_xinerama_is_active_reply_t *reply;
|
||||||
reply = xcb_xinerama_is_active_reply(conn, xcb_xinerama_is_active(conn), NULL);
|
reply = xcb_xinerama_is_active_reply(conn, xcb_xinerama_is_active(conn), NULL);
|
||||||
|
|
||||||
if (!reply->state) {
|
if (reply == NULL || !reply->state) {
|
||||||
LOG("Xinerama is not active (in your X-Server), disabling.\n");
|
LOG("Xinerama is not active (in your X-Server), disabling.\n");
|
||||||
free(reply);
|
FREE(reply);
|
||||||
disable_xinerama(conn);
|
disable_xinerama(conn);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(reply);
|
FREE(reply);
|
||||||
|
|
||||||
query_screens(conn, virtual_screens);
|
query_screens(conn, virtual_screens);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user