diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-18 23:42:15 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-18 23:42:15 +0000 |
commit | f623ce8c90a606e717db9285e7effaf8bac6abb4 (patch) | |
tree | 2ed7b431a0a47bbe792cef2b51f9474f91ff434a /net/disk_cache | |
parent | d3732d9fe191eb03562cba91563eef3350e176b9 (diff) | |
download | chromium_src-f623ce8c90a606e717db9285e7effaf8bac6abb4.zip chromium_src-f623ce8c90a606e717db9285e7effaf8bac6abb4.tar.gz chromium_src-f623ce8c90a606e717db9285e7effaf8bac6abb4.tar.bz2 |
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
Diffstat (limited to 'net/disk_cache')
-rw-r--r-- | net/disk_cache/file_posix.cc | 6 |
1 files changed, 6 insertions, 0 deletions
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<const char*>(buffer); + return ret; } |