mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
examples: check asprintf return value in client_info.c
On error, asprintf returns -1 and the contents of the string pointer is undefined. In the rest of the libvirt code, the virAsprintf wrapper takes care of that. Check the return value and report a generic error, since we purposefully avoid linking to virutil.
This commit is contained in:
parent
8764c99a40
commit
aa7bb4f36d
@ -86,6 +86,11 @@ exampleGetTypedParamValue(virTypedParameterPtr item)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "error formatting typed param value\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user