[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PULL 11/73] cryptodev: Support query-stats QMP command
|
From: |
Peter Maydell |
|
Subject: |
Re: [PULL 11/73] cryptodev: Support query-stats QMP command |
|
Date: |
Tue, 2 May 2023 18:03:20 +0100 |
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
- Re: [PULL 11/73] cryptodev: Support query-stats QMP command,
Peter Maydell <=