diff options
author | Ian Roxborough <irox@redhat.com> | 2001-09-08 21:55:17 +0000 |
---|---|---|
committer | Ian Roxborough <irox@redhat.com> | 2001-09-08 21:55:17 +0000 |
commit | 926d71c5c29102926ff1cf87828cad68a79bce56 (patch) | |
tree | 5db22f4f17ca5f8c78ab7fffe45a79a617c3f666 /libgui/src/tkWinPrintCanvas.c | |
parent | b111a96ea19bde1004ecea63c7827a1d4b0b73ef (diff) | |
download | gdb-LIBGUI_TCL_8_3.tar.gz |
libgui import for Tcl/Tk8.3 upgradeLIBGUI_TCL_8_3
Diffstat (limited to 'libgui/src/tkWinPrintCanvas.c')
-rw-r--r-- | libgui/src/tkWinPrintCanvas.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libgui/src/tkWinPrintCanvas.c b/libgui/src/tkWinPrintCanvas.c index 5b7bc41830a..029c6687f52 100644 --- a/libgui/src/tkWinPrintCanvas.c +++ b/libgui/src/tkWinPrintCanvas.c @@ -52,20 +52,20 @@ PrintCanvasCmd(clientData, interp, argc, argv) int tiles_wide,tiles_high; int tile_y, tile_x; int screenX1, screenX2, screenY1, screenY2, width, height; - DOCINFO *lpdi = malloc(sizeof(DOCINFO)); + DOCINFO *lpdi = (DOCINFO *) ckalloc(sizeof(DOCINFO)); if (argc < 2) { Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], " canvas \"", (char *) NULL); - return TCL_ERROR; + goto error; } /* The second arg is the canvas widget */ if (!Tcl_GetCommandInfo(interp, argv[1], &canvCmd)) { Tcl_AppendResult(interp, "couldn't get canvas information for \"", argv[1], "\"", (char *) NULL); - return TCL_ERROR; + goto error; } memset(&dm,0,sizeof(DEVMODE)); @@ -74,7 +74,7 @@ PrintCanvasCmd(clientData, interp, argc, argv) memset(lpdi,0,sizeof(DOCINFO)); lpdi->cbSize=sizeof(DOCINFO); - lpdi->lpszDocName=malloc(255); + lpdi->lpszDocName= (LPCSTR) ckalloc(255); sprintf((char*)lpdi->lpszDocName,"SN - Printing\0"); lpdi->lpszOutput=NULL; @@ -164,8 +164,12 @@ PrintCanvasCmd(clientData, interp, argc, argv) EndDoc(pd.hDC); done: + ckfree ((char*) lpdi->lpszDocName); + ckfree ((char*) lpdi); return TCL_OK; - error: +error: + ckfree ((char*) lpdi->lpszDocName); + ckfree ((char*) lpdi); return TCL_ERROR; } |