Fixed memory leak. Discovered by Coverity (CID 1013).
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25639 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2007, Ingo Weinhold, [email protected].
|
* Copyright 2001-2008, Ingo Weinhold, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -1810,7 +1810,9 @@ TRoster::_LoadRosterSettings(const char *path)
|
|||||||
off_t size;
|
off_t size;
|
||||||
if (!error)
|
if (!error)
|
||||||
error = file.GetSize(&size);
|
error = file.GetSize(&size);
|
||||||
char *data;
|
|
||||||
|
char *data = NULL;
|
||||||
|
|
||||||
if (!error) {
|
if (!error) {
|
||||||
data = new(nothrow) char[size];
|
data = new(nothrow) char[size];
|
||||||
error = data ? B_OK : B_NO_MEMORY;
|
error = data ? B_OK : B_NO_MEMORY;
|
||||||
@@ -1821,6 +1823,9 @@ TRoster::_LoadRosterSettings(const char *path)
|
|||||||
}
|
}
|
||||||
if (!error)
|
if (!error)
|
||||||
error = stream.SetTo(std::string(data));
|
error = stream.SetTo(std::string(data));
|
||||||
|
|
||||||
|
delete[] data;
|
||||||
|
|
||||||
if (!error) {
|
if (!error) {
|
||||||
// Clear the current lists as
|
// Clear the current lists as
|
||||||
// we'll be manually building them up
|
// we'll be manually building them up
|
||||||
|
|||||||
Reference in New Issue
Block a user