mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-21 12:41:19 +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
d9a8faf644
commit
bd119c71f6
1 changed files with 5 additions and 2 deletions
|
@ -819,6 +819,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
char *src_ptr,*dest_ptr;
|
char *src_ptr,*dest_ptr;
|
||||||
int len,quote;
|
int len,quote;
|
||||||
unsigned char ch;
|
unsigned char ch;
|
||||||
|
NSString *ret;
|
||||||
|
|
||||||
/* xxx Really should make this work with unichars. */
|
/* xxx Really should make this work with unichars. */
|
||||||
|
|
||||||
|
@ -843,7 +844,7 @@ handle_printf_atsign (FILE *stream,
|
||||||
if (quote)
|
if (quote)
|
||||||
len+=2;
|
len+=2;
|
||||||
|
|
||||||
dest = (char*) malloc (len+1);
|
dest = (char*) objc_malloc (len+1);
|
||||||
|
|
||||||
src_ptr = (char*) src;
|
src_ptr = (char*) src;
|
||||||
dest_ptr = dest;
|
dest_ptr = dest;
|
||||||
|
@ -881,7 +882,9 @@ handle_printf_atsign (FILE *stream,
|
||||||
*(dest_ptr++) = '\"';
|
*(dest_ptr++) = '\"';
|
||||||
*dest_ptr = '\0';
|
*dest_ptr = '\0';
|
||||||
|
|
||||||
return [NSString stringWithCString:dest];
|
ret = [NSString stringWithCString:dest];
|
||||||
|
objc_free (dest);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) writeToFile: (NSString*)filename
|
- (BOOL) writeToFile: (NSString*)filename
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue