blob: 8cfd50d013299e0f047eda21f12f1e8d1a844bea (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/log/log.h>
#include <vespa/fastos/fastos.h>
#include <vespa/vespalib/testkit/testapp.h>
LOG_SETUP("realloc_test");
TEST_SETUP(Test);
int Test::Main() {
char * v = static_cast<char *>(malloc(0x400001));
char * nv = static_cast<char *>(realloc(v, 0x500001));
ASSERT_TRUE(v == nv);
v = static_cast<char *>(realloc(nv, 0x600001));
ASSERT_TRUE(v != nv);
free(v);
char *t = static_cast<char *>(malloc(70));
free (t+7);
t = static_cast<char *>(malloc(0x400001));
free (t+7);
return 0;
}
|