diff options
author | Larry Ewing <lewing@gimp.org> | 1999-07-19 04:21:09 +0000 |
---|---|---|
committer | Larry Ewing <lewing@src.gnome.org> | 1999-07-19 04:21:09 +0000 |
commit | e0fe9318327b8c08d56774d70eb9802c5af14024 (patch) | |
tree | aec39705c38369dd37822b84b5cd39b3277f5eca /gdk-pixbuf/io-xpm.c | |
parent | 6423183a63b8294c52597bfa96ad2e1bb015ffa1 (diff) | |
download | gtk+-e0fe9318327b8c08d56774d70eb9802c5af14024.tar.gz |
Fix a few memory leaks in the, most of them in error cases but one or two
1999-07-18 Larry Ewing <lewing@gimp.org>
* src/io-xpm.c:
* src/io-gif.c:
* src/io-png.c:
* src/io-jpeg.c: Fix a few memory leaks in the, most of them in
error cases but one or two in the common case. There are probably
a few small ones left.
Diffstat (limited to 'gdk-pixbuf/io-xpm.c')
-rw-r--r-- | gdk-pixbuf/io-xpm.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/gdk-pixbuf/io-xpm.c b/gdk-pixbuf/io-xpm.c index d4532cc997..98c7532f17 100644 --- a/gdk-pixbuf/io-xpm.c +++ b/gdk-pixbuf/io-xpm.c @@ -329,6 +329,7 @@ static GdkPixBuf * buffer = (*get_buf) (op_cmap, handle); if (!buffer) { g_warning("Can't load XPM colormap"); + g_hash_table_destroy(color_hash); g_free(name_buf); g_free(colors); return NULL; @@ -396,6 +397,9 @@ static GdkPixBuf * } } } + g_hash_table_destroy(color_hash); + g_free(colors); + g_free(name_buf); /* Ok, now stuff the GdkPixBuf with goodies */ @@ -407,15 +411,15 @@ static GdkPixBuf * pixbuf->art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, (w * 3)); /* Ok, I'm anal...shoot me */ - if (!(pixbuf->art_pixbuf)) - return NULL; + if (!(pixbuf->art_pixbuf)) { + art_free(pixels); + g_free(pixbuf); + return NULL; + } + pixbuf->ref_count = 0; pixbuf->unref_func = NULL; - g_hash_table_destroy(color_hash); - g_free(colors); - g_free(name_buf); - return pixbuf; } |