brintos

brintos / llvm-project-archived public Read only

0
0
Text · 789 B · 67437bd Raw
42 lines · cpp
1//===-- Integration Test for Scudo ----------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include <stdlib.h>10 11static const size_t ALLOC_SIZE = 128;12 13int main() {14  void *P = malloc(ALLOC_SIZE);15  if (P == nullptr) {16    return 1;17  }18 19  free(P);20 21  P = calloc(4, ALLOC_SIZE);22  if (P == nullptr) {23    return 2;24  }25 26  P = realloc(P, ALLOC_SIZE * 8);27  if (P == nullptr) {28    return 3;29  }30 31  free(P);32 33  P = aligned_alloc(64, ALLOC_SIZE);34  if (P == nullptr) {35    return 4;36  }37 38  free(P);39 40  return 0;41}42