aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Hawthorn <jhawthor@uvic.ca>2008-06-05 16:32:18 -0700
committerJohn Hawthorn <jhawthor@uvic.ca>2008-06-05 16:32:18 -0700
commitab9fe4157144f5293311a036576d80be6016165d (patch)
tree2589d4604c66e5a6d597d787dec921b2bcf5206d /src
parent4e6066a8c8f54266afd65c18f3d6df2f657c7cc5 (diff)
downloadmirror-meh-ab9fe4157144f5293311a036576d80be6016165d.tar.gz
mirror-meh-ab9fe4157144f5293311a036576d80be6016165d.tar.bz2
mirror-meh-ab9fe4157144f5293311a036576d80be6016165d.zip
fixed memory leaks
Diffstat (limited to 'src')
-rw-r--r--src/main.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index f0baad1..c116fab 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;