mirror of
https://gitlab.freedesktop.org/xorg/lib/libxcb-errors.git
synced 2026-01-04 02:50:15 +01:00
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:
parent
761079ac8a
commit
fb56799357
1 changed files with 4 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue