On Wed, 8 Mar 2023 at 01:11, Michael S. Tsirkin <m...@redhat.com> wrote: > > From: zhenwei pi <pizhen...@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