Correctly handle calloc() failure

If an extension that we support is not present in the X11 server, this is not a
fatal error. We can just skip this extension. However, the code implementing
this accidentally also made calloc()-failures non-fatal which is wrong.

Spotted by Ran Benita.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2015-04-04 16:17:29 +02:00
parent 761079ac8a
commit fb56799357

View file

@ -58,12 +58,12 @@ int register_extension(xcb_errors_context_t *ctx, xcb_connection_t *conn,
reply = xcb_query_extension_reply(conn, cookie, NULL);
if (!info || !reply || !reply->present) {
int had_error = !reply || reply->present;
int not_present = reply && !reply->present;
free(info);
free(reply);
if (had_error)
return -1;
return 0;
if (not_present)
return 0;
return -1;
}
info->name = name;