mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
([NSString -description]): Free DEST to prevent memory leak!
(Reported by Wolfgang Baron <wbaron@ixpoint.de>.) git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2014 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0ffadf7405
commit
6cc88537f8
1 changed files with 5 additions and 2 deletions
|
@ -819,6 +819,7 @@ handle_printf_atsign (FILE *stream,
|
|||
char *src_ptr,*dest_ptr;
|
||||
int len,quote;
|
||||
unsigned char ch;
|
||||
NSString *ret;
|
||||
|
||||
/* xxx Really should make this work with unichars. */
|
||||
|
||||
|
@ -843,7 +844,7 @@ handle_printf_atsign (FILE *stream,
|
|||
if (quote)
|
||||
len+=2;
|
||||
|
||||
dest = (char*) malloc (len+1);
|
||||
dest = (char*) objc_malloc (len+1);
|
||||
|
||||
src_ptr = (char*) src;
|
||||
dest_ptr = dest;
|
||||
|
@ -881,7 +882,9 @@ handle_printf_atsign (FILE *stream,
|
|||
*(dest_ptr++) = '\"';
|
||||
*dest_ptr = '\0';
|
||||
|
||||
return [NSString stringWithCString:dest];
|
||||
ret = [NSString stringWithCString:dest];
|
||||
objc_free (dest);
|
||||
return ret;
|
||||
}
|
||||
|
||||
- (BOOL) writeToFile: (NSString*)filename
|
||||
|
|
Loading…
Reference in a new issue