From 28471f774b1fdca4f02e90064209f5b16f143aa4 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Thu, 5 Sep 2013 15:37:52 +0200 Subject: CID#705713: fix memory leak Change-Id: Ic157c57fcf3fd30fe46c8c09098d532fef9cd4b2 --- sfx2/source/doc/printhelper.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 918d1ca52eed..603331c61873 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -680,7 +680,8 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& // of the URL. The URL we save for later using separately. // Execution of the print job will be done later by executing // a slot ... - pUCBPrintTempFile = new ::utl::TempFile(); + if(!pUCBPrintTempFile) + pUCBPrintTempFile = new ::utl::TempFile(); pUCBPrintTempFile->EnableKillingFile(); //FIXME: does it work? @@ -772,7 +773,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& // a) printing finished => move the file directly and forget the watcher thread // b) printing is asynchron and runs currently => start watcher thread and exit this method // This thread make all necessary things by itself. - if (pUCBPrintTempFile!=NULL) + if (pUCBPrintTempFile) { // a) SfxPrinter* pPrinter = pView->GetPrinter(); @@ -782,7 +783,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >& else { // Note: we create(d) some resource on the heap. (thread and tep file) - // They will be delected by the thread automaticly if he finish his run() method. + // They will be deleted by the thread automaticly if he finish his run() method. ImplUCBPrintWatcher* pWatcher = new ImplUCBPrintWatcher( pPrinter, pUCBPrintTempFile, sUcbUrl ); pWatcher->create(); } -- cgit