Plug more leaks; don't call malloc() with zero size.

This commit is contained in:
Nate Weaver 2012-07-04 23:43:18 -05:00
parent 76281dd506
commit ed032720a8
2 changed files with 5 additions and 1 deletions

View File

@ -63,6 +63,10 @@
if(length < _minLength) length = _minLength;
// read string
if (length == 0)
return;
void *buffer = malloc(length);
if(_minLength) memset(buffer, 0, _minLength);
[stream readAmount:length toBuffer:buffer];

View File

@ -219,7 +219,7 @@
- (void)revertResource:(id)sender
{
[resource setData:[[backup data] copy]];
[resource setData:[[[backup data] copy] autorelease]];
}
- (void)readTemplate:(id<ResKnifeResourceProtocol>)tmplRes