From bab419f56f846d2563490e99bd4d5fde031397e9 Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Wed, 18 Jul 2012 03:48:50 +0200 Subject: [PATCH] fix memoryleak --- dunst.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dunst.c b/dunst.c index a51dbad..b94a568 100644 --- a/dunst.c +++ b/dunst.c @@ -447,17 +447,17 @@ void draw_win(void) /* resize window and draw background */ if (width == 0) { printf("Warning: width == 0\n"); - return; + goto draw_win_cleanup; } if (height == 0) { printf("Warning: height == 0\n"); - return; + goto draw_win_cleanup; } if (font_h == 0) { printf("Warning: font_h == 0\n"); - return; + goto draw_win_cleanup; } resizedc(dc, width, height * font_h); XResizeWindow(dc->dpy, win, width, height * font_h); @@ -480,6 +480,8 @@ void draw_win(void) XMoveWindow(dc->dpy, win, x, y); mapdc(dc, win, width, height * font_h); + +draw_win_cleanup: /* cleanup */ free(n_buf); }