Mercurial > dwindows
diff win/dw.c @ 1143:b1b23de965d7
Fixed using a pointer after being free()ed on Windows and Mac.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 10 Sep 2011 18:34:25 +0000 |
parents | 1c63bf62e0b0 |
children | 091ed7c20b3f |
line wrap: on
line diff
--- a/win/dw.c Sat Sep 10 17:59:37 2011 +0000 +++ b/win/dw.c Sat Sep 10 18:34:25 2011 +0000 @@ -10050,13 +10050,13 @@ { DWPrint *p = print; HPIXMAP pixmap; - int x; + int x, result = DW_ERROR_UNKNOWN; if(!p) - return DW_ERROR_UNKNOWN; + return result; if (!(pixmap = calloc(1,sizeof(struct _hpixmap)))) - return DW_ERROR_UNKNOWN; + return result; pixmap->width = GetDeviceCaps(p->pd.hDC, PHYSICALWIDTH); pixmap->height = GetDeviceCaps(p->pd.hDC, PHYSICALHEIGHT); @@ -10079,10 +10079,12 @@ EndPage(p->pd.hDC); } EndDoc(p->pd.hDC); + if(p->drawfunc) + result = DW_ERROR_NONE; /* Free memory */ dw_pixmap_destroy(pixmap); free(p); - return p->drawfunc ? DW_ERROR_NONE : DW_ERROR_UNKNOWN; + return result; } /*