On Wed, 22 Mar 2023 13:34:12 +0200
Bing Zhao <bi...@nvidia.com> wrote:

> +
> +             port_name = (char *)malloc(IF_NAMESIZE);
> +             if (port_name == NULL) {
> +                     fclose(file);
> +                     rte_errno = ENOMEM;
> +                     return -rte_errno;
> +             }
> +             line_size = getline(&port_name, &port_name_size, file);

This code is doing unnecessary extra work here.
From getline() man page:

     If *lineptr is set to NULL before the call, then getline() will
       allocate a buffer for storing the line.  This buffer should be
       freed by the user program even if getline() failed.

Reply via email to