The memory allocated by VIR_REALLOC_N() is uninitialized, which means it's not possible to figure out whether any output was produced at all after the fact. Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> --- src/util/vircommand.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index d965068369..6e9e56d0c0 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -2057,11 +2057,13 @@ virCommandProcessIO(virCommandPtr cmd) outfd = cmd->outfd; if (VIR_REALLOC_N(*cmd->outbuf, 1) < 0) ret = -1; + *cmd->outbuf[0] = '\0'; } if (cmd->errbuf) { errfd = cmd->errfd; if (VIR_REALLOC_N(*cmd->errbuf, 1) < 0) ret = -1; + *cmd->errbuf[0] = '\0'; } if (ret == -1) goto cleanup; -- 2.20.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list