06/02/2026 09:12, David Marchand:
> On Thu, 5 Feb 2026 at 22:30, Thomas Monjalon <[email protected]> wrote:
> > @@ -446,8 +447,14 @@ find_numasocket(struct hugepage_file *hugepg_tbl, 
> > struct hugepage_info *hpi)
> >                 return 0;
> >         }
> >
> > -       snprintf(hugedir_str, sizeof(hugedir_str),
> > -                       "%s/%s", hpi->hugedir, eal_get_hugefile_prefix());
> > +       ret = asprintf(&hugedir_str, "%s/%s",
> > +                       hpi->hugedir, eal_get_hugefile_prefix());
> > +       if (ret < 0) {
> > +               EAL_LOG(ERR, "%s(): failed to store hugepage path", 
> > __func__);
> > +               goto error;
> 
> On asprintf failure, hugedir_str content is undefined.
> It is safer to reset hugedir_str to NULL before jumping to the error
> label where free() is called.

You're right, I do this small change:

        if (ret < 0) {
                EAL_LOG(ERR, "%s(): failed to store hugepage path", __func__);
+               hugedir_str = NULL;
                goto error;
        }




Reply via email to