On Fri, Jul 01, 2016 at 15:01:35 +0200, Ján Tomko wrote:
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.
---
examples/admin/client_info.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/examples/admin/client_info.c b/examples/admin/client_info.c
index dd0a04a..314a090 100644
--- a/examples/admin/client_info.c
+++ b/examples/admin/client_info.c
@@ -86,6 +86,11 @@ exampleGetTypedParamValue(virTypedParameterPtr item)
return NULL;
}
+ if (ret < 0) {
+ fprintf(stderr, "error formatting typed param value\n");
+ return NULL;
+ }
+
return str;
}
ACK
Jirka