On Wed, Sep 25, 2024 at 12:19:29AM +0200, René Scharfe wrote: > Am 24.09.24 um 08:32 schrieb Patrick Steinhardt: > > diff --git a/reftable/basics.c b/reftable/basics.c > > index 3350bbffa23..82bfb807631 100644 > > --- a/reftable/basics.c > > +++ b/reftable/basics.c > > @@ -152,14 +152,26 @@ void parse_names(char *buf, int size, char ***namesp) > > } > > if (p < next) { > > REFTABLE_ALLOC_GROW(names, names_len + 1, names_cap); > > - names[names_len++] = xstrdup(p); > > + if (!names) > > + goto err; > > + > > + names[names_len] = strdup(p); > > + if (!names[names_len++]) > > + goto err; > > } > > p = next + 1; > > } > > > > REFTABLE_REALLOC_ARRAY(names, names_len + 1); > > names[names_len] = NULL; > > - *namesp = names; > > + > > + return names; > > + > > +err: > > + for (size_t i = 0; i < names_len; i++) > > + free(names[i]); > > + free(names); > > These are allocated with reftable_realloc() under the hood, so they'd > better be passed to reftable_free() instead, no? Oh yeah, good catch! I'll wait a bit longer for feedback before sending out a revised version. Patrick