[PATCH dpdk] log: fix double free on cleanup

Stephen Hemminger stephen at networkplumber.org
Fri Nov 29 17:54:50 CET 2024


On Fri, 29 Nov 2024 17:10:14 +0100
Robin Jarry <rjarry at redhat.com> wrote:

> @@ -550,11 +555,8 @@ eal_log_init(const char *id)
>  void
>  rte_eal_log_cleanup(void)
>  {
> -	FILE *log_stream = rte_logs.file;
> -
> -	/* don't close stderr on the application */
> -	if (log_stream != NULL)
> -		fclose(log_stream);
> -
> +	if (rte_logs.is_internal_file && rte_logs.file != NULL)
> +		fclose(rte_logs.file);
>  	rte_logs.file = NULL;
> +	rte_logs.is_internal_file = false;
>  }

The internal flag is ok, but we still don't want to close
stderr in cleanup. Only places where syslog or journal wrapper is used.


More information about the dev mailing list