Hi Ilya,

[also CCing Baptiste]

On Tue, Oct 03, 2017 at 05:25:17PM +0500, ???? ??????? wrote:
> [src/dns.c:2502]: (error) Memory leak: buffer
> 
> 
> I do not see any "buffer" usage except conditional free.
> should we just remove "buffer" from there ?

I think you're referring to this part :

struct dns_resolution *dns_alloc_resolution(void)
{
        struct dns_resolution *resolution = NULL;
        char *buffer = NULL;

        resolution = calloc(1, sizeof(*resolution));
        buffer = calloc(1, global.tune.bufsize);

        if (!resolution || !buffer) {
                free(buffer);
                free(resolution);
                return NULL;
        }

        LIST_INIT(&resolution->requester.wait);
        LIST_INIT(&resolution->requester.curr);

        return resolution;
}

And there's definitely a memory leak on the allocated buffer. Buffers
used to be needed for resolution in the past but I think that's no
longer the case, so I think that indeed the buffer can be completely
removed (unless it should be assigned somewhere of course). It's
possible that there are other such places after the DNS processing
was refactored some time ago.

Thanks,
Willy

> 
> Cheers,
> Ilya Shipitsin

Reply via email to