From f623ce8c90a606e717db9285e7effaf8bac6abb4 Mon Sep 17 00:00:00 2001 From: "rvargas@google.com" Date: Thu, 18 Sep 2008 23:42:15 +0000 Subject: Fix a memory leak on the disk cache for posix. Review URL: http://codereview.chromium.org/3154 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2393 0039d316-1c4b-4281-b951-d872f2087c98 --- net/disk_cache/file_posix.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'net/disk_cache/file_posix.cc') diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc index 842b4e7..1dcd141 100644 --- a/net/disk_cache/file_posix.cc +++ b/net/disk_cache/file_posix.cc @@ -100,6 +100,12 @@ bool File::AsyncWrite(const void* buffer, size_t buffer_len, size_t offset, bool ret = Write(buffer, buffer_len, offset); if (ret && completed) *completed = true; + + // If we supply our own async callback, and the caller is not asking to be + // notified when completed, we are supposed to delete the buffer. + if (ret && !callback && !notify) + delete[] reinterpret_cast(buffer); + return ret; } -- cgit v1.1