]> git.proxmox.com Git - mirror_qemu.git/commitdiff
cryptodev: fix memory leak during stats query
authorzhenwei pi <pizhenwei@bytedance.com>
Wed, 3 May 2023 11:54:37 +0000 (19:54 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 23 Jun 2023 07:09:45 +0000 (03:09 -0400)
object_get_canonical_path already returns newly allocated memory, this
means no additional g_strdup required. Remove g_strdup to avoid memory
leak.

Fixes: Coverity CID 1508074
Fixes: f2b901098 ("cryptodev: Support query-stats QMP command")
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Message-Id: <20230503115437.262469-1-pizhenwei@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
backends/cryptodev.c

index 94ca393cee3b801ddaf44637bfffb06e59216e8f..7d295178433be5c2b3d53d9ebaee4d4513196a0d 100644 (file)
@@ -522,7 +522,7 @@ 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));
+    entry->qom_path = object_get_canonical_path(obj);
     entry->stats = stats_list;
     QAPI_LIST_PREPEND(*stats_results, entry);