Skip to contentSkip to conversation

qemu-opts: Release id on deletion

PATCH New Jan Kiszka 1 participant 1 message Dec 1, 2009

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 qemu-opts: Release id on deletion

The opts id is always allocated via qemu_strdup, so it need not be const, but it has to be released on opts deletion.

---

 qemu-option.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
qemu-option.c +2 -1
index 49efd39..b009109 100644
@@ -481,7 +481,7 @@ struct QemuOpt {
 };
 
 struct QemuOpts {
-    const char *id;
+    char *id;
     QemuOptsList *list;
     QTAILQ_HEAD(QemuOptHead, QemuOpt) head;
     QTAILQ_ENTRY(QemuOpts) next;
@@ -686,6 +686,7 @@ void qemu_opts_del(QemuOpts *opts)
         qemu_opt_del(opt);
     }
     QTAILQ_REMOVE(&opts->list->head, opts, next);
+    qemu_free(opts->id);
     qemu_free(opts);
 }