
On 04/08/2014 04:48 PM, Daniel P. Berrange wrote:
In debugging a crash on OOM, I thought that the virInsert APIs might be at fault, but couldn't isolate them as a cause. While the viralloc APIs are used in many test suites, this is as a side-effect, they are not directly tested :-)
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- tests/Makefile.am | 5 + tests/viralloctest.c | 387 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 392 insertions(+) create mode 100644 tests/viralloctest.c
+ + +static int +testAllocArray(const void *opaque ATTRIBUTE_UNUSED) +{ + testDummyStruct *t; + size_t nt = 10, i; + int ret = -1; + + if (VIR_ALLOC_N(t, nt) < 0) + return -1; + + if (t == NULL) { + fprintf(stderr, "Allocation succeeded by pointer is NULL\n");
s/by pointer/but pointer/ in the whole file
+ goto cleanup; + }
ACK Jan