qemu-devel
[Top][All Lists]
Advanced

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

Re: Re: [PULL 11/73] cryptodev: Support query-stats QMP command


From: zhenwei pi
Subject: Re: Re: [PULL 11/73] cryptodev: Support query-stats QMP command
Date: Wed, 3 May 2023 12:19:24 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0



On 5/3/23 01:03, Peter Maydell wrote:
On Wed, 8 Mar 2023 at 01:11, Michael S. Tsirkin <mst@redhat.com> wrote:

From: zhenwei pi <pizhenwei@bytedance.com>

Now we can use "query-stats" QMP command to query statistics of
crypto devices. (Originally this was designed to show statistics
by '{"execute": "query-cryptodev"}'. Daniel Berrangé suggested that
querying configuration info by "query-cryptodev", and querying
runtime performance info by "query-stats". This makes sense!)

Hi; Coverity points out (CID 1508074) that this change
introduces a memory leak:

+static int cryptodev_backend_stats_query(Object *obj, void *data)
+{

+    entry = g_new0(StatsResult, 1);
+    entry->provider = STATS_PROVIDER_CRYPTODEV;
+    entry->qom_path = g_strdup(object_get_canonical_path(obj));

object_get_canonical_path() already returns allocated memory
that the caller should free with g_free(), so we should not
g_strdup() it (which then leaks that memory).

+    entry->stats = stats_list;
+    QAPI_LIST_PREPEND(*stats_results, entry);
+
+    return 0;
+}

Would somebody like to send a patch?

thanks
-- PMM

Hi,

Thanks for pointing out this, I'll fix this later.

--
zhenwei pi



reply via email to

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