mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
Fixed memory leak in jasper loader
Bug 578290. The "data" block was allocated but not used and not freed.
This commit is contained in:
parent
ea866c635b
commit
a15b14032e
@ -163,7 +163,6 @@ jasper_image_try_load (struct jasper_context *context, GError **error)
|
|||||||
|
|
||||||
if (!context->pixbuf) {
|
if (!context->pixbuf) {
|
||||||
int bits_per_sample;
|
int bits_per_sample;
|
||||||
guchar *data;
|
|
||||||
|
|
||||||
/* Unfortunately, gdk-pixbuf doesn't support 16 bpp images
|
/* Unfortunately, gdk-pixbuf doesn't support 16 bpp images
|
||||||
* bits_per_sample = jas_image_cmptprec (image, 0);
|
* bits_per_sample = jas_image_cmptprec (image, 0);
|
||||||
@ -174,17 +173,16 @@ jasper_image_try_load (struct jasper_context *context, GError **error)
|
|||||||
*/
|
*/
|
||||||
bits_per_sample = 8;
|
bits_per_sample = 8;
|
||||||
|
|
||||||
data = g_try_malloc0 (context->width * context->height * bits_per_sample / 8);
|
context->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
||||||
if (data == NULL) {
|
FALSE, bits_per_sample,
|
||||||
|
context->width, context->height);
|
||||||
|
if (context->pixbuf == NULL) {
|
||||||
g_set_error_literal (error,
|
g_set_error_literal (error,
|
||||||
GDK_PIXBUF_ERROR,
|
GDK_PIXBUF_ERROR,
|
||||||
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
||||||
_("Insufficient memory to open JPEG 2000 file"));
|
_("Insufficient memory to open JPEG 2000 file"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
context->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
|
||||||
FALSE, bits_per_sample,
|
|
||||||
context->width, context->height);
|
|
||||||
if (context->prepared_func)
|
if (context->prepared_func)
|
||||||
context->prepared_func (context->pixbuf, NULL, context->user_data);
|
context->prepared_func (context->pixbuf, NULL, context->user_data);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user