From 3dca38cf98461a962bb4445da5db5fc440694d55 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 14 Mar 2016 15:03:39 +0000 Subject: 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 --- gtk/resources.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gtk') 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; -- cgit v1.2.3