qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 2/4] qtest: introduce qmp_exec_hmp_cmd()


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v3 2/4] qtest: introduce qmp_exec_hmp_cmd()
Date: Fri, 6 Jun 2014 15:20:28 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Fri, Jun 06, 2014 at 09:11:58AM +0800, Amos Kong wrote:
> +void qmp_exec_hmp_cmd(const char *expected_ret, const char *fmt, ...)
> +{
> +    va_list ap;
> +    char cmd[1024];
> +    char *escaped_cmd;
> +    QDict *response;
> +    const char *response_return;
> +
> +    va_start(ap, fmt);
> +    vsprintf(cmd, fmt, ap);
> +    va_end(ap);
> +
> +    escaped_cmd = g_strescape(cmd, NULL);
> +    response = qmp("{\"execute\": \"human-monitor-command\","
> +                   " \"arguments\": {"
> +                   "   \"command-line\": \"%s\""
> +                   "}}", escaped_cmd);
> +    free(escaped_cmd);

glib uses g_malloc()/g_free() instead of malloc()/free().  Please use
g_free() since the string comes from g_strescape().



reply via email to

[Prev in Thread] Current Thread [Next in Thread]