summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-12 21:53:49 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-12 21:53:49 +0000
commit589ec5f3a790f9e765f8627f31e874de2dcff556 (patch)
tree6e363adbbd54d2e4a15a0962160f359b19247737
parent57144f5466b408e3aa4271f4dcb605669fa7e756 (diff)
downloadchromium_src-589ec5f3a790f9e765f8627f31e874de2dcff556.zip
chromium_src-589ec5f3a790f9e765f8627f31e874de2dcff556.tar.gz
chromium_src-589ec5f3a790f9e765f8627f31e874de2dcff556.tar.bz2
Coverity: linux: fix leak in Clipboard::WriteData with disallowed format.
CID=9154 TEST=none BUG=none Review URL: http://codereview.chromium.org/2946006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52134 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--app/clipboard/clipboard_linux.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/clipboard/clipboard_linux.cc b/app/clipboard/clipboard_linux.cc
index 56d359f..275c37e 100644
--- a/app/clipboard/clipboard_linux.cc
+++ b/app/clipboard/clipboard_linux.cc
@@ -216,13 +216,13 @@ void Clipboard::WriteBookmark(const char* title_data, size_t title_len,
void Clipboard::WriteData(const char* format_name, size_t format_len,
const char* data_data, size_t data_len) {
- char* data = new char[data_len];
- memcpy(data, data_data, data_len);
std::string format(format_name, format_len);
// We assume that certain mapping types are only written by trusted code.
// Therefore we must upkeep their integrity.
if (format == kMimeBmp || format == kMimeURI)
return;
+ char* data = new char[data_len];
+ memcpy(data, data_data, data_len);
InsertMapping(format.c_str(), data, data_len);
}