aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar senorblanco <senorblanco@chromium.org>2014-09-09 12:37:16 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-09 12:37:16 -0700
commit4459a0448d84d4adb53984227fbee4c581f13a98 (patch)
tree8cc493ff32c96497ffc8cd0a2405344daca42c4b
parent7476cf533be14b84e83de1bf30db7eef889c1f23 (diff)
When parsing arguments on Windows, check malloc() for failure.
Note: this code is only executed by Skia utilities AFAIK, not by external clients. BUG=skia:2642 R=reed@google.com Author: senorblanco@chromium.org Review URL: https://codereview.chromium.org/548343002
-rw-r--r--src/views/win/skia_win.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/views/win/skia_win.cpp b/src/views/win/skia_win.cpp
index 72ff54fedd..e2f0fdaf94 100644
--- a/src/views/win/skia_win.cpp
+++ b/src/views/win/skia_win.cpp
@@ -100,7 +100,7 @@ static SkOSWindow* gSkWind;
char* tchar_to_utf8(const TCHAR* str) {
#ifdef _UNICODE
int size = WideCharToMultiByte(CP_UTF8, 0, str, wcslen(str), NULL, 0, NULL, NULL);
- char* str8 = (char*) malloc(size+1);
+ char* str8 = (char*) sk_malloc_throw(size+1);
WideCharToMultiByte(CP_UTF8, 0, str, wcslen(str), str8, size, NULL, NULL);
str8[size] = '\0';
return str8;
@@ -150,7 +150,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow, LPTSTR lpCmdLine)
gSkWind = create_sk_window(hWnd, argc, argv);
for (int i = 0; i < argc; ++i) {
- free(argv[i]);
+ sk_free(argv[i]);
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);