Il 06/06/2014 16:33, Amos Kong ha scritto:
+    va_end(ap);
+
+    escaped_cmd = g_strescape(cmd, NULL);
+    response = qmp("{\"execute\": \"human-monitor-command\","
+                   " \"arguments\": {"
+                   "   \"command-line\": \"%s\""
+                   "}}", escaped_cmd);
+    g_free(escaped_cmd);

Instead of adding g_strescape everywhere, we should use json-parser's own interpolation support. See this patch: http://article.gmane.org/gmane.comp.emulators.qemu/279836 which also fixes a leak as a bonus.

Also, you can use ' instead of " if you fix another long-standing bug: http://article.gmane.org/gmane.comp.emulators.qemu/279835

Paolo

Reply via email to