Revert 281133 "chrome.hid: enrich model with report IDs"
[chromium-blink-merge.git] / base / process / memory.cc
blob1dbc36307037de7f578650f9f3b3ec10d3dfbe1e
1 // Copyright 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.
5 #include "base/process/memory.h"
7 namespace base {
9 // Defined in memory_mac.mm for Mac.
10 #if !defined(OS_MACOSX)
12 bool UncheckedCalloc(size_t num_items, size_t size, void** result) {
13 const size_t alloc_size = num_items * size;
15 // Overflow check
16 if (size && ((alloc_size / size) != num_items)) {
17 *result = NULL;
18 return false;
21 if (!UncheckedMalloc(alloc_size, result))
22 return false;
24 memset(*result, 0, alloc_size);
25 return true;
28 #endif