summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-tga.c
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2002-09-03 23:43:21 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2002-09-03 23:43:21 +0000
commitcd6bd5620952c88623aa631ed334bf1e8628ea39 (patch)
treea19ea8bbb2b60fddaadda6ac209ec81509f3dbeb /gdk-pixbuf/io-tga.c
parent0f2acdd6b42cb45fbe762a9182b2364f066bb530 (diff)
downloadgdk-pixbuf-cd6bd5620952c88623aa631ed334bf1e8628ea39.tar.gz
Don't leak memory if g_try_realloc fails.
* io-tga.c (io_buffer_append): * io-ico.c (DecodeHeader): * io-bmp.c (grow_buffer): Don't leak memory if g_try_realloc fails. * gdk-pixbuf-io.c (pixbuf_check_ico): Fix loading of .CUR files. (#91826)
Diffstat (limited to 'gdk-pixbuf/io-tga.c')
-rw-r--r--gdk-pixbuf/io-tga.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gdk-pixbuf/io-tga.c b/gdk-pixbuf/io-tga.c
index 08259d832..ff453e528 100644
--- a/gdk-pixbuf/io-tga.c
+++ b/gdk-pixbuf/io-tga.c
@@ -182,14 +182,15 @@ static IOBuffer *io_buffer_append(IOBuffer *buffer,
g_memmove(buffer->data, data, len);
buffer->size = len;
} else {
- buffer->data = g_try_realloc(buffer->data, buffer->size + len);
- if (!buffer->data) {
+ guchar *tmp = g_try_realloc (buffer->data, buffer->size + len);
+ if (!tmp) {
g_set_error(err, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Can't realloc IOBuffer data"));
g_free(buffer);
return NULL;
}
+ buffer->data = tmp;
g_memmove(&buffer->data[buffer->size], data, len);
buffer->size += len;
}