diff options
author | Matthias Clasen <matthiasc@src.gnome.org> | 2002-09-03 23:43:21 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2002-09-03 23:43:21 +0000 |
commit | cd6bd5620952c88623aa631ed334bf1e8628ea39 (patch) | |
tree | a19ea8bbb2b60fddaadda6ac209ec81509f3dbeb /gdk-pixbuf/io-tga.c | |
parent | 0f2acdd6b42cb45fbe762a9182b2364f066bb530 (diff) | |
download | gdk-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.c | 5 |
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; } |