Re: [PATCH] sctp_xconnect: memory leak when malloc big buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 11, 2013 at 03:22:41PM +0800, Fan Du wrote:
> CLIENT repeatly call process_ready_sockets, which malloc without free,
> so sctp_xconnect exit unexpectly.
> 
> Signed-off-by: Fan Du <fan.du@xxxxxxxxxxxxx>
> ---
>  apps/sctp_xconnect.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/apps/sctp_xconnect.c b/apps/sctp_xconnect.c
> index 5874c33..4e33040 100644
> --- a/apps/sctp_xconnect.c
> +++ b/apps/sctp_xconnect.c
> @@ -573,6 +573,7 @@ void process_ready_sockets(int client_socket[], int assoc_num, fd_set *rfds) {
>  			}
>  		}
>  	}
> +	free(big_buffer); 
>  }
>  
Definately a leak, but it seems like it would be better solved by making those
buffers static allocations.  Its a single threaded app, why do all that malloc
and free in a forever while loop when you don't really need to?

Neil

>  int main(int argc, char *argv[]) {
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Networking Development]     [Linux OMAP]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux