Subject: Re: [PATCH v4] iproute2: prevent memory leak

From: Stephen Hemminger <[email-masked]>
Date: Thu, 16 Nov 2023 15:05:21 -0800

On Thu, 16 Nov 2023 11:13:08 +0800
heminhong <[email-masked]> wrote:

> When the return value of rtnl_talk() is not less than 0,
> 'answer' will be allocated. The 'answer' should be free
> after using, otherwise it will cause memory leak.
> 
> Signed-off-by: heminhong <[email-masked]>

I am skeptical, what is the code path through rtn_talk() that
returns non zero, and allocates answer.  If so, that should be fixed
there.

In current code, the returns are:
	- sendmsg() fails
	- recvmsg() fails
	- truncated message
	
The paths that set answer are returning 0