There is a very unlikely use after free bug and a memory leak in
live_update_start() of xenstore_control. Fix those.
Coverity-Id:
1472399
Fixes: 7f97193e6aa858 ("tools/xenstore: add live update command to xenstore-control")
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
if (len < 0)
return 1;
+ ret = strdup("BUSY");
+ if (!ret)
+ return 1;
+
for (time_start = time(NULL); time(NULL) - time_start < to;) {
+ free(ret);
ret = xs_control_command(xsh, "live-update", buf, len);
if (!ret)
goto err;