Fix use after free in error message

This commit is contained in:
Mikael Magnusson 2013-08-11 12:02:30 +02:00
parent f55caaf6a0
commit 937ba3c7e7

View file

@ -652,10 +652,9 @@ RrImage* RrImageNewFromName(RrImageCache *cache, const gchar *name)
} }
#endif #endif
g_free(path);
if (!loaded) { if (!loaded) {
g_message("Cannot load image \"%s\" from file \"%s\"", name, path); g_message("Cannot load image \"%s\" from file \"%s\"", name, path);
g_free(path);
#if defined(USE_LIBRSVG) #if defined(USE_LIBRSVG)
DestroyRsvgLoader(rsvg_loader); DestroyRsvgLoader(rsvg_loader);
#endif #endif
@ -665,6 +664,8 @@ RrImage* RrImageNewFromName(RrImageCache *cache, const gchar *name)
return NULL; return NULL;
} }
g_free(path);
/* get an RrImage that contains an RrImageSet with this picture in it. /* get an RrImage that contains an RrImageSet with this picture in it.
the RrImage might be new, or reused if the picture was already in the the RrImage might be new, or reused if the picture was already in the
cache. cache.