
On Thu, Apr 24, 2014 at 04:00:35PM -0600, Eric Blake wrote:
On 04/24/2014 02:25 PM, Nehal J Wani wrote:
+static int +testAllocScalar(const void *opaque ATTRIBUTE_UNUSED) +{ + testDummyStruct *t; + int ret = -1; + + if (VIR_ALLOC(t) < 0) + return -1; + + if (t == NULL) { + fprintf(stderr, "Allocation succeeded by pointer is NULL\n"); + goto cleanup; + }
Just out of curiosity, why don't we have this check after VIR_REALLOC_N, VIR_EXPAND_N, VIR_SHRINK_N and VIR_RESIZE_N ?
As this patch hasn't been pushed yet, maybe the following can be squashed in?
diff --git a/tests/viralloctest.c b/tests/viralloctest.c index abdd871..d5818c7 100644 --- a/tests/viralloctest.c +++ b/tests/viralloctest.c @@ -33,6 +33,17 @@ typedef struct testDummyStruct { } testDummyStruct;
static int +testCheckNonNull(void *t) +{ + if (t == NULL) { + fprintf(stderr, "Allocation succeeded by pointer is NULL\n");
s/by/but/
Looks reasonable to me.
Yep, forgot I hadn't pushed this, so will squash the changes in. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|