summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-05-29 23:22:35 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2012-05-29 23:22:35 -0700
commit53d99608451ade88d59d8baae6fc543d6922fb0a (patch)
tree5b1c05cd9f02e05de0aa7ebb5b415c96261671b7
parenta7909448b89f42ad0bb4834e347e6d3ecb20d7da (diff)
Fix pixmap leak in error paths of BWGetUnzoomedPixmap
Found by Parfait 0.5.0.1 bug checking tool: Leaked X Resource pix at line 393 of Bitmap.c in function 'BWGetUnzoomedPixmap'. pix initialized at line 388 with XCreatePixmap(...). at line 414 of Bitmap.c in function 'BWGetUnzoomedPixmap'. pix initialized at line 409 with XCreatePixmap(...). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--Bitmap.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Bitmap.c b/Bitmap.c
index 8171bef..704cb98 100644
--- a/Bitmap.c
+++ b/Bitmap.c
@@ -389,8 +389,10 @@ BWGetUnzoomedPixmap(Widget w)
BW->bitmap.zoom.image->width,
BW->bitmap.zoom.image->height, 1);
if (!(gc = XCreateGC(XtDisplay(w), pix,
- (unsigned long) 0, (XGCValues *) 0)))
+ (unsigned long) 0, (XGCValues *) 0))) {
+ XFreePixmap(XtDisplay(w), pix);
return (Pixmap) None;
+ }
XPutImage(XtDisplay(w), pix, gc,
BW->bitmap.zoom.image,
@@ -410,8 +412,10 @@ BWGetUnzoomedPixmap(Widget w)
BW->bitmap.image->width,
BW->bitmap.image->height, 1);
if (! (gc = XCreateGC(XtDisplay(w), pix,
- (unsigned long) 0, (XGCValues *) 0)))
+ (unsigned long) 0, (XGCValues *) 0))){
+ XFreePixmap(XtDisplay(w), pix);
return (Pixmap) None;
+ }
XPutImage(XtDisplay(w), pix, gc,
BW->bitmap.image,