Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: base/process/memory.cc

Issue 55333002: Make possible to check memory allocations inside chromium (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes inspired by trybots Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/process/memory.h ('k') | base/process/memory_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/process/memory.h"
6
7 namespace base {
8
9 // Defined in memory_mac.mm for Mac.
10 #if !defined(OS_MACOSX)
11
12 bool UncheckedCalloc(size_t num_items, size_t size, void** result) {
13 const size_t alloc_size = num_items * size;
14
15 // Overflow check
16 if (size && ((alloc_size / size) != num_items)) {
17 *result = NULL;
18 return false;
19 }
20
21 if (!UncheckedMalloc(alloc_size, result))
22 return false;
23
24 memset(*result, 0, alloc_size);
25 return true;
26 }
27
28 #endif
29
30 }
OLDNEW
« no previous file with comments | « base/process/memory.h ('k') | base/process/memory_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698