[project @ 2006-01-24 23:05:56 by rjw]

Handle memory failure better.

svn path=/import/netsurf/; revision=2030
This commit is contained in:
Richard Wilson 2006-01-24 23:05:56 +00:00
parent ef1f971a9a
commit ab9856c52a

View File

@ -67,7 +67,7 @@ bool nsjpeg_convert(struct content *c, int w, int h)
unsigned int height;
unsigned int width;
struct bitmap *bitmap = NULL;
char *pixels;
char *pixels = NULL;
size_t rowstride;
union content_msg_data msg_data;
@ -95,8 +95,12 @@ bool nsjpeg_convert(struct content *c, int w, int h)
height = cinfo.output_height;
bitmap = bitmap_create(width, height, false);
if (!bitmap) {
if (bitmap)
pixels = bitmap_get_buffer(bitmap);
if ((!bitmap) || (!pixels)) {
jpeg_destroy_decompress(&cinfo);
if (bitmap)
bitmap_destroy(bitmap);
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
@ -105,7 +109,6 @@ bool nsjpeg_convert(struct content *c, int w, int h)
}
bitmap_set_opaque(bitmap, true);
pixels = bitmap_get_buffer(bitmap);
rowstride = bitmap_get_rowstride(bitmap);
do {
JSAMPROW scanlines[1];