Re: [Plib-devel] [PATCH] puAuxLargeInput.cxx: fix leak
Brought to you by:
sjbaker
From: Fay, J. F Dr C. U. A. 46 S. <joh...@eg...> - 2009-01-29 17:35:33
|
OK, I have put this one in as well. John F. Fay Technical Fellow Jacobs Technology TEAS Group 850-883-1294 -----Original Message----- From: Melchior FRANZ [mailto:mf...@us...] Sent: Thursday, January 29, 2009 8:30 AM To: pli...@li... Subject: [Plib-devel] [PATCH] puAuxLargeInput.cxx: fix leak Hi, I just noticed that I didn't free the buffer in puaLargeInput::getTextProperties(). Please apply this patch. Sorry. m. diff --git a/src/puAux/puAuxLargeInput.cxx b/src/puAux/puAuxLargeInput.cxx index 11834e6..8ac1f19 100644 --- a/src/puAux/puAuxLargeInput.cxx +++ b/src/puAux/puAuxLargeInput.cxx @@ -1219,7 +1219,7 @@ int puaLargeInput::checkKey ( int key, int updown ) void puaLargeInput::getTextProperties(int *numlines, int *maxwidth) { int num = 0, max = 0 ; - char *s = ulStrDup ( getStringValue () ) ; + char *buf = ulStrDup ( getStringValue () ), *s = buf ; while ( *s ) { char *cr = strchr ( s, '\n' ) ; if ( cr ) @@ -1233,6 +1233,7 @@ void puaLargeInput::getTextProperties(int *numlines, int *maxwidth) } *numlines = num ; *maxwidth = max ; + delete [] buf ; } char *puaLargeInput::wrapText ( int target_width, int *numlines, int *maxwidth ) ------------------------------------------------------------------------ ------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ plib-devel mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-devel |