On 7/25/26 9:43 PM, Léo Hardt wrote:
vtv: fix memory leak by freeing unnecessary variable

Currently, vtable_find_or_create_map_decl, given a class decl,
calls get_mangled_vtable_map_var_name (from mangle.cc) to:

   (1) create a VTV map entry for the given class; and
   (2) return the expected DECL_ASSEMBLER_NAME of its VTV tracker.

Creating this decl is only needed once for each class,
hence the 'if' clause on vtable-class-hierarchy.cc:1120.

On this patch I note that if we don't need to create the decl, we
should dispose of the xmalloc'd 'var_name' that won't be stored.

Since there is only one listed maintainer for libvtv, who doesn't
seem active in recent years, is it possible for global reviewers
to take a look at this patch?

I hope the logic is straightforward enough: both the caller and
callee mentioned above have a single caller, and this variable is
only used inside the 'if' condition.

Then it seems like it would be better to move the variable inside the condition?

Jason

Reply via email to