Commit 9fc572a7 authored by satorux@chromium.org's avatar satorux@chromium.org

gdata: Fix a leak from GDataEntry::FromProtoString()

The leakage ocurrred on failure.

BUG=136597
TEST=tools/valgrind/valgrind.sh  --leak-check=full  out/Release/unit_tests --gtest_filter=GDataDBTest.*

Review URL: https://chromiumcodereview.appspot.com/10735040

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146058 0039d316-1c4b-4281-b951-d872f2087c98
parent c2c88aa3
......@@ -734,20 +734,20 @@ scoped_ptr<GDataEntry> GDataEntry::FromProtoString(
GDataDirectoryProto dir_proto;
bool ok = dir_proto.ParseFromString(serialized_proto);
if (ok && dir_proto.gdata_entry().file_info().is_directory()) {
GDataDirectory* dir = new GDataDirectory(NULL, NULL);
scoped_ptr<GDataDirectory> dir(new GDataDirectory(NULL, NULL));
if (!dir->FromProto(dir_proto))
return scoped_ptr<GDataEntry>(NULL);
return scoped_ptr<GDataEntry>(dir);
return scoped_ptr<GDataEntry>(dir.release());
}
GDataFileProto file_proto;
ok = file_proto.ParseFromString(serialized_proto);
if (ok) {
DCHECK(!file_proto.gdata_entry().file_info().is_directory());
GDataFile* file = new GDataFile(NULL, NULL);
scoped_ptr<GDataFile> file(new GDataFile(NULL, NULL));
if (!file->FromProto(file_proto))
return scoped_ptr<GDataEntry>(NULL);
return scoped_ptr<GDataEntry>(file);
return scoped_ptr<GDataEntry>(file.release());
}
return scoped_ptr<GDataEntry>(NULL);
}
......
......@@ -5550,16 +5550,6 @@
fun:_ZN16RenderThreadImplC1ERKSs
fun:_ZN21WebRTCAudioDeviceTest5SetUpEv
}
{
bug_chromium_os_32464
Memcheck:Leak
fun:_Znw*
fun:_ZN5gdata10GDataEntry15FromProtoStringERKSs
fun:_ZN5gdata12GDataLevelDB15GetByResourceIdERKSsP10scoped_ptrINS_10GDataEntryEE
...
fun:_ZN5gdata12_GLOBAL__N_111*
fun:_ZN5gdata38GDataDBTest_IncompatibleProtoTest_Test8TestBodyEv
}
#-----------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment