Re: ntpd: fix some memory leaks in dns handling

2015-01-20 Thread Brent Cook
On Mon, Jan 12, 2015 at 10:02 AM, Todd C. Miller todd.mil...@courtesan.com wrote: On Mon, 12 Jan 2015 09:12:02 -0600, Brent Cook wrote: - Nothing seems to free the result of host_dns(), so add host_dns_free() and call after each query. - If imsg_add fails, it frees buf. Avoid

Re: ntpd: fix some memory leaks in dns handling

2015-01-12 Thread Brent Cook
Fri, Jan 09, 2015 at 03:32:37PM -0700, Todd C. Miller wrote: On Fri, 09 Jan 2015 15:45:51 -0600, Brent Cook wrote: - If imsg_add fails, it frees buf. But, so does imsg_close. Punt for now and just die if imsg_add fails (maybe this should be handled more nicely?) I think it makes

Re: ntpd: fix some memory leaks in dns handling

2015-01-12 Thread Todd C. Miller
On Mon, 12 Jan 2015 09:12:02 -0600, Brent Cook wrote: - Nothing seems to free the result of host_dns(), so add host_dns_free() and call after each query. - If imsg_add fails, it frees buf. Avoid dereferencing the freed buf afterward in imsg_close(). That looks good to me. - todd

ntpd: fix some memory leaks in dns handling

2015-01-09 Thread Brent Cook
From: Brent Cook bust...@gmail.com These are all sort of related, so they're merged into one. - Nothing seems to free the result of host_dns(), so add host_dns_free() and call after each query. - If imsg_add fails, it frees buf. But, so does imsg_close. Punt for now and just die if

Re: ntpd: fix some memory leaks in dns handling

2015-01-09 Thread Todd C. Miller
On Fri, 09 Jan 2015 15:45:51 -0600, Brent Cook wrote: - If imsg_add fails, it frees buf. But, so does imsg_close. Punt for now and just die if imsg_add fails (maybe this should be handled more nicely?) I think it makes sense to treat imsg_add() failure the same as imsg_create returning