Le 04/10/2017 à 07:49, Илья Шипицин a écrit :


2017-10-04 9:15 GMT+05:00 Willy Tarreau <[email protected] <mailto:[email protected]>>:

    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


great. I'll send a patch today


Hi,

I'm working on the DNS part to make it thread-safe. In my patch set, among other things, I fixed this one. I will send everything to Willy in few days. So don't bother with it.

Thanks
--
Christopher Faulet


Reply via email to