[prev in list] [next in list] [prev in thread] [next in thread]
List: openbsd-tech
Subject: Re: [patch] relayd(8) may lose memory in relay_udp()
From: "patrick keshishian" <pkeshish () gmail ! com>
Date: 2008-01-28 18:16:08
Message-ID: 53b425b00801281016h254982c3y8f83f75db0f79431 () mail ! gmail ! com
[Download RAW message or body]
On Jan 28, 2008 5:48 AM, Igor Zinovik <zinovik@cs.karelia.ru> wrote:
> Hello, tech@ readers.
>
> relayd(8) may lose memory allocate to varaible `cnl' (struct
> ctl_natlook). Seems that it should free `cnl' allocated memory.
>
> --- relay_udp.c.orig Mon Jan 28 08:50:13 2008
> +++ relay_udp.c Mon Jan 28 08:54:11 2008
> @@ -261,6 +261,8 @@ relay_udp_server(int fd, short sig, void
> /* Save the received data */
> if (evbuffer_add(con->out.output, buf, len) == -1) {
> relay_close(con, "failed to store buffer");
> + if (cnl != NULL)
> + free(cnl);
> return;
> }
Source free(3):
The free() function causes the space pointed to by ptr to be either
placed on a list of free pages to make it available for future allocation
or, if required, to be returned to the kernel using munmap(2). If ptr is
a null pointer, no action occurs.
The NULL check seems unnecessary.
Best,
--patrick
>
>
--
"How romantic. Two lovers' first kiss shared on
the banks of the river Seine" -- LL as CK (ep.72 s04e06)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic