From 15f13d88d20917138d6e6cb38df6341f6b676cf6 Mon Sep 17 00:00:00 2001 From: Michael Vrhel Date: Tue, 27 Jan 2015 17:06:13 -0800 Subject: Fix mismatching allocation and deallocation issues. The form of delete should match the form that is used in the new command. Otherwise the behavior is undefined. --- platform/windows/gsprint/gsprint.cpp | 8 ++++---- platform/windows/mupdfnet/mupdfnet.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'platform/windows') diff --git a/platform/windows/gsprint/gsprint.cpp b/platform/windows/gsprint/gsprint.cpp index 813364a8..4f4a3924 100644 --- a/platform/windows/gsprint/gsprint.cpp +++ b/platform/windows/gsprint/gsprint.cpp @@ -30,7 +30,7 @@ SYMBOL_DECLSPEC int __stdcall ShowPropertiesDialog(void *hptr, void *printername if (!OpenPrinter(output, &hPrinter, NULL)) { - free(output); + delete[] output; return FAIL; } @@ -39,7 +39,7 @@ SYMBOL_DECLSPEC int __stdcall ShowPropertiesDialog(void *hptr, void *printername pDevMode = (LPDEVMODE)malloc(dwNeeded); if (pDevMode == NULL) { - free(output); + delete[] output; ClosePrinter(hPrinter); return FAIL; } @@ -53,7 +53,7 @@ SYMBOL_DECLSPEC int __stdcall ShowPropertiesDialog(void *hptr, void *printername dwRet = DocumentProperties(hWnd, hPrinter, output, pDevMode, NULL, fMode); if (dwRet != IDOK) { - free(output); + delete[] output; ClosePrinter(hPrinter); free(pDevMode); return FAIL; @@ -67,7 +67,7 @@ SYMBOL_DECLSPEC int __stdcall ShowPropertiesDialog(void *hptr, void *printername /* Clean up */ free(pDevMode); - free(output); + delete[] output; ClosePrinter(hPrinter); return 0; } diff --git a/platform/windows/mupdfnet/mupdfnet.cpp b/platform/windows/mupdfnet/mupdfnet.cpp index 854d40c5..a778537a 100644 --- a/platform/windows/mupdfnet/mupdfnet.cpp +++ b/platform/windows/mupdfnet/mupdfnet.cpp @@ -452,13 +452,13 @@ SYMBOL_DECLSPEC int __stdcall mExtractPages(PCWSTR infile, PCWSTR outfile, fz_optind = 1; result = pdfclean_main(argc, argv); - delete(num); + delete[] num; delete(infilechar); delete(outfilechar); if (has_password) delete(passchar); if (num_pages > 0) - delete(pagenums); + delete[] pagenums; delete(argv); return result; } -- cgit v1.2.3