Fixed leaks. CID 893 and 894. There are still some leaks in this file, but the code is too complex and I won't touch it. I'd feel better if someone who knows it better would have a look
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27739 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8ddfb2fdb5
commit
02de38b077
@ -1216,6 +1216,7 @@ TTextView::MessageReceived(BMessage *msg)
|
||||
}
|
||||
if (file.Read(text, size) < B_OK) {
|
||||
puts("could not read from file");
|
||||
free(text);
|
||||
continue;
|
||||
}
|
||||
if (!inserted) {
|
||||
@ -2515,7 +2516,6 @@ TTextView::Reader::Run(void *_this)
|
||||
|
||||
header = eol;
|
||||
}
|
||||
if (buffer)
|
||||
free(buffer);
|
||||
reader->Process("\r\n", 2, true);
|
||||
}
|
||||
@ -2597,7 +2597,6 @@ done:
|
||||
reader->Unlock();
|
||||
|
||||
delete reader;
|
||||
if (msg)
|
||||
free(msg);
|
||||
|
||||
return B_NO_ERROR;
|
||||
@ -3120,9 +3119,11 @@ TTextView::AddQuote(int32 start, int32 finish)
|
||||
int32 lineLength = index - lastLine + 1;
|
||||
|
||||
target = (char *)realloc(target, targetLength + lineLength + quoteLength);
|
||||
if (target == NULL)
|
||||
if (target == NULL) {
|
||||
// free the old buffer?
|
||||
free(text);
|
||||
return;
|
||||
}
|
||||
|
||||
// copy the quote sign
|
||||
memcpy(&target[targetLength], QUOTE, quoteLength);
|
||||
|
Loading…
x
Reference in New Issue
Block a user