Re: BUG #17632: a potential bug of memory leak

Поиск
Список
Период
Сортировка
От Japin Li
Тема Re: BUG #17632: a potential bug of memory leak
Дата
Msg-id ME3P282MB1667AC5E1F8031E86782E894B6239@ME3P282MB1667.AUSP282.PROD.OUTLOOK.COM
обсуждение исходный текст
Ответ на BUG #17632: a potential bug of memory leak  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
On Tue, 11 Oct 2022 at 10:33, PG Bug reporting form <noreply@postgresql.org> wrote:
> The following bug has been logged on the website:
>
> Bug reference:      17632
> Logged by:          a potential bug of memory leak
> Email address:      1157401338@qq.com
> PostgreSQL version: 14.5
> Operating system:   ubuntu20.04
> Description:        
>
> Hi, I found a potential memory leak bug in the project source
> code of postgre, and I have shown the execution sequence of the program
> that
> may generate the bug on a graph,which can be access by
> https://docimg8.docs.qq.com/image/AgAACEPRUipmYhhKHB5OOoBr8hpUfqC5.png?w=2192&h=1336
> The red text illustrates the steps that generate the bug,,the file path can
> be seen in the blue framed
> section.
>
>
> Although the code shown is for version 12.12 but is still exist in current
> version
>
>
> would you can help to check if this bug is true?thank you for your effort
> and patience!

The alloc_var() release the memory before allocating memory:

    static int
    alloc_var(numeric *var, int ndigits)
    {
        digitbuf_free(var->buf);    /* SEE HERE */
        var->buf = digitbuf_alloc(ndigits + 1);
        if (var->buf == NULL)
            return -1;
        var->buf[0] = 0;
        var->digits = var->buf + 1;
        var->ndigits = ndigits;
        return 0;
    }

So, I don't think it leaks.

-- 
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.



В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17632: a potential bug of memory leak
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17633: Define rule on views which do insert to another relation trigger cache lookup failed error.