On Tue, Mar 17, 2026 at 11:04:57AM +0800, Leon Hwang wrote:

SNIP

> > +static __u32 *get_ids(const char * const funcs[], int funcs_cnt, const 
> > char *mod)
> > +{
> > +   struct btf *btf, *vmlinux_btf;
> > +   __u32 nr, type_id, cnt = 0;
> > +   void *root = NULL;
> > +   __u32 *ids = NULL;
> > +   int i, err = 0;
> > +
> > +   btf = btf__load_vmlinux_btf();
> > +   if (!ASSERT_OK_PTR(btf, "btf__load_vmlinux_btf"))
> > +           return NULL;
> > +
> > +   if (mod) {
> > +           vmlinux_btf = btf;
> > +           btf = btf__load_module_btf(mod, vmlinux_btf);
> > +           if (!ASSERT_OK_PTR(btf, "btf__load_module_btf"))
> > +                   return NULL;
>                         ^ vmlinux_btf does not get released.

right, needs to be 'goto out'

> 
> > +   }
> > +
> > +   ids = calloc(funcs_cnt, sizeof(ids[0]));
> > +   if (!ids)
> > +           goto out;
> > +
> > +   /*
> > +    * We sort function names by name and search them
> > +    * below for each function.
> > +    */
> > +   for (i = 0; i < funcs_cnt; i++)
> > +           tsearch(&funcs[i], &root, compare);
>                 ^ tdestroy() is missing to free tree nodes?

right, will add, thanks

jirka

Reply via email to