summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2010-04-26 13:26:20 (GMT)
committer Vincent Sanders <vince@netsurf-browser.org>2010-04-26 13:26:20 (GMT)
commit50f6ee7bd5cecb308ccf6284b0a44595adcf3903 (patch)
tree7153467c98f3de5892b65d2d3cd6f6104e4062ed
parent5a8f21c5354ba883225eb1cd3ef013d5c8f79a90 (diff)
downloadlibnsfb-50f6ee7bd5cecb308ccf6284b0a44595adcf3903.tar.gz
libnsfb-50f6ee7bd5cecb308ccf6284b0a44595adcf3903.tar.bz2
ensure reply is not leaked if server does not support shared memory
svn path=/trunk/libnsfb/; revision=10489
-rw-r--r--src/surface/x.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/surface/x.c b/src/surface/x.c
index 6fddfca..356b1bf 100644
--- a/src/surface/x.c
+++ b/src/surface/x.c
@@ -497,10 +497,15 @@ create_shm_image(xstate_t *xstate, int width, int height, int bpp)
ck = xcb_shm_query_version(xstate->connection);
rep = xcb_shm_query_version_reply(xstate->connection, ck , NULL);
- if ((!rep) ||
- (rep->major_version < 1) ||
- (rep->major_version == 1 && rep->minor_version == 0)) {
- fprintf (stderr, "No or insufficient shm support...\n");
+ if (!rep) {
+ fprintf (stderr, "Server has no shm support.\n");
+ return NULL;
+ }
+
+ if((rep->major_version < 1) ||
+ (rep->major_version == 1 && rep->minor_version == 0)) {
+ fprintf (stderr, "server SHM support is insufficient.\n");
+ free(rep);
return NULL;
}
free(rep);