On Tue, 2024-02-27 at 13:47 -0800, Kui-Feng Lee wrote: [...] > > @@ -997,7 +1004,8 @@ find_struct_ops_kern_types(struct bpf_object *obj, const char *tname, > > if (i == btf_vlen(kern_vtype)) { > > pr_warn("struct_ops init_kern: struct %s data is not found in struct %s%s\n", > > tname, STRUCT_OPS_VALUE_PREFIX, tname); > > - return -EINVAL; > > + err = -EINVAL; > > + goto err_out; > > } > > > > *type = kern_type; > > @@ -1007,6 +1015,10 @@ find_struct_ops_kern_types(struct bpf_object *obj, const char *tname, > > *data_member = kern_data_member; > > Where is going to free tname when it successes? My bad, thank you for spotting this. > > > > return 0; > > + > > +err_out: > > + free(tname); > > + return err; > > } > > > > static bool bpf_map__is_struct_ops(const struct bpf_map *map)