]> Git Repo - qemu.git/commitdiff
HMP: Initialize err before using
authorzhangjixiang <[email protected]>
Sun, 25 Feb 2018 01:47:51 +0000 (09:47 +0800)
committerDr. David Alan Gilbert <[email protected]>
Tue, 20 Mar 2018 12:32:06 +0000 (12:32 +0000)
When bdrv_snapshot_delete return fail, the errp will not be
assigned a valid value in error_propagate as errp didn't be
initialized in hmp_delvm, then error_reportf_err will use an
uninitialized value(call by hmp_delvm), and qemu crash.

Signed-off-by: zhangjixiang <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
hmp.c

diff --git a/hmp.c b/hmp.c
index ba9e299ee2ee3c66caff53ab6d9e185ffba8b14d..fd13d5b56a979ac94c7c3c9c1aae864bb16e83cc 100644 (file)
--- a/hmp.c
+++ b/hmp.c
@@ -1321,7 +1321,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict)
 void hmp_delvm(Monitor *mon, const QDict *qdict)
 {
     BlockDriverState *bs;
-    Error *err;
+    Error *err = NULL;
     const char *name = qdict_get_str(qdict, "name");
 
     if (bdrv_all_delete_snapshot(name, &bs, &err) < 0) {
This page took 0.028979 seconds and 4 git commands to generate.