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.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to