diff options
author | John Hawthorn <jhawthor@uvic.ca> | 2008-06-05 16:32:18 -0700 |
---|---|---|
committer | John Hawthorn <jhawthor@uvic.ca> | 2008-06-05 16:32:18 -0700 |
commit | ab9fe4157144f5293311a036576d80be6016165d (patch) | |
tree | 2589d4604c66e5a6d597d787dec921b2bcf5206d | |
parent | 4e6066a8c8f54266afd65c18f3d6df2f657c7cc5 (diff) | |
download | mirror-meh-ab9fe4157144f5293311a036576d80be6016165d.tar.gz mirror-meh-ab9fe4157144f5293311a036576d80be6016165d.tar.bz2 mirror-meh-ab9fe4157144f5293311a036576d80be6016165d.zip |
fixed memory leaks
-rw-r--r-- | src/main.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -45,6 +45,7 @@ void setaspect(int w, int h){ hints->min_aspect.x = hints->max_aspect.x = w; hints->min_aspect.y = hints->max_aspect.y = h; XSetWMNormalHints(display, window, hints); + XFree(hints); } XImage *create_image_from_buffer(unsigned char *buf, int width, int height, int bufwidth, int bufheight) { @@ -85,7 +86,6 @@ XImage *create_image_from_buffer(unsigned char *buf, int width, int height, int width, height, 32, 0 ); - }else if(depth >= 15){ size_t numNewBufBytes = (2 * (width * height)); u_int16_t *newBuf = malloc (numNewBufBytes); @@ -207,8 +207,10 @@ void run(struct imagenode *image){ break; case ConfigureNotify: if(width != event.xconfigure.width || height != event.xconfigure.height){ - if(img) - free(img); + if(img){ + free(img->data); + XFree(img); + } img = NULL; width = event.xconfigure.width; height = event.xconfigure.height; @@ -234,8 +236,10 @@ void run(struct imagenode *image){ image = image->prev; direction = -1; } - if(img) - free(img); + if(img){ + free(img->data); + XFree(img); + } if(buf) free(buf); img = NULL; |