[Plib-devel] [PATCH] puAuxLargeInput.cxx: fix leak
Brought to you by:
sjbaker
|
From: Melchior F. <mf...@us...> - 2009-01-29 14:29:51
|
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 )
|