Example from coverity scan vhostmd-1.1/vhostmd/util.c: scope_hint: In function 'vu_append_string' vhostmd-1.1/vhostmd/util.c:484:7: warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Wunused-result] asprintf(&cp, "%s,%s", *dest, str); Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx> --- vhostmd/util.c | 3 ++- vhostmd/vhostmd.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/vhostmd/util.c b/vhostmd/util.c index 317dbc6..d7ce3fc 100644 --- a/vhostmd/util.c +++ b/vhostmd/util.c @@ -488,7 +488,8 @@ int vu_append_string(char **dest, xmlChar * str) char *cp; if (*dest) { - asprintf(&cp, "%s,%s", *dest, str); + if (asprintf(&cp, "%s,%s", *dest, str) < 0) + return -1; free(*dest); *dest = cp; } diff --git a/vhostmd/vhostmd.c b/vhostmd/vhostmd.c index 7e29e6f..7374ec9 100644 --- a/vhostmd/vhostmd.c +++ b/vhostmd/vhostmd.c @@ -259,7 +259,8 @@ static int parse_group_metric(xmlDocPtr xml ATTRIBUTE_UNUSED, vu_log(VHOSTMD_WARN, "parse_group_metric: node path not found"); return -1; } - asprintf(&cp, "%s/variable", path); + if (asprintf(&cp, "%s/variable", path) < 0) + goto error; obj = xmlXPathEval( BAD_CAST cp, ctxt); if ((obj == NULL) || (obj->type != XPATH_NODESET)) { -- 2.16.4 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list