diff options
author | Vincent Sanders <vince@kyllikki.org> | 2016-03-14 15:03:39 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2016-03-14 15:03:39 +0000 |
commit | 3dca38cf98461a962bb4445da5db5fc440694d55 (patch) | |
tree | 462c3d66067270443973dcca7002afa6ffca90b0 /gtk/resources.c | |
parent | 1ace8538d1cc4db594a58ea9ec355f7c6182af5e (diff) | |
download | netsurf-3dca38cf98461a962bb4445da5db5fc440694d55.tar.gz netsurf-3dca38cf98461a962bb4445da5db5fc440694d55.tar.bz2 |
Avoid null dereference in gtk resource handling
Ensure the error handling in gtk pixmap resource handling does not
cause a null pointer dereference. Fixes coverity CID 1307743
Diffstat (limited to 'gtk/resources.c')
-rw-r--r-- | gtk/resources.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gtk/resources.c b/gtk/resources.c index 2906e0ac2..dfe3d3dad 100644 --- a/gtk/resources.c +++ b/gtk/resources.c @@ -484,10 +484,16 @@ nsgdk_pixbuf_new_from_resname(const char *resname, GdkPixbuf **pixbuf_out) /* pixbuf resources are not currently direct */ break; } + if (new_pixbuf == NULL) { - LOG("Unable to create pixbuf from file for %s with path %s \"%s\"", + if (error != NULL) { + LOG("Unable to create pixbuf from file for %s with path %s \"%s\"", resource->name, resource->path, error->message); - g_error_free(error); + g_error_free(error); + } else { + LOG("Unable to create pixbuf from file for %s with path %s", + resource->name, resource->path); + } return NSERROR_INIT_FAILED; } *pixbuf_out = new_pixbuf; |