diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-05-29 23:22:35 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-05-29 23:22:35 -0700 |
commit | 53d99608451ade88d59d8baae6fc543d6922fb0a (patch) | |
tree | 5b1c05cd9f02e05de0aa7ebb5b415c96261671b7 /Bitmap.c | |
parent | a7909448b89f42ad0bb4834e347e6d3ecb20d7da (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>
Diffstat (limited to 'Bitmap.c')
-rw-r--r-- | Bitmap.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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, |