You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I compiled the 'parse_plpgsql.c' and tested it with file "plpgsql_samples.sql". ASan and valgrind find memory leak in pg_query_parse.c:52
==136926==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 1 byte(s) in 1 object(s) allocated from:
#0 0x7fd98c8b32f0 in __strdup (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x752f0)
#1 0x414020 in pg_query_raw_parse src/pg_query_parse.c:52
SUMMARY: AddressSanitizer: 1 byte(s) leaked in 1 allocation(s).
==137686== Memcheck, a memory error detector
==137686== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==137686== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==137686== Command: ./parse_plpgsql plpgsql_samples.sql
==137686==
==137686==
==137686== HEAP SUMMARY:
==137686== in use at exit: 345,690 bytes in 45 blocks
==137686== total heap usage: 198 allocs, 153 frees, 1,276,459 bytes allocated
==137686==
==137686== 1 bytes in 1 blocks are definitely lost in loss record 1 of 31
==137686== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==137686== by 0x4EBFB49: strdup (strdup.c:42)
==137686== by 0x414020: pg_query_raw_parse (pg_query_parse.c:52)
==137686== by 0x4022BC: pg_query_parse_plpgsql (pg_query_parse_plpgsql.c:396)
==137686== by 0x401785: main (parse_plpgsql.c:44)
==137686==
==137686== LEAK SUMMARY:
==137686== definitely lost: 1 bytes in 1 blocks
==137686== indirectly lost: 0 bytes in 0 blocks
==137686== possibly lost: 0 bytes in 0 blocks
==137686== still reachable: 345,689 bytes in 44 blocks
==137686== suppressed: 0 bytes in 0 blocks
==137686== Reachable blocks (those to which a pointer was found) are not shown.
==137686== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==137686==
==137686== For counts of detected and suppressed errors, rerun with: -v
==137686== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 1)
After debugging by gdb, I found it seems 'result.stderr_buffer' doesn't free correctly when parse plpgsql.(seems function pg_query_free_parse_result(pg_query_parse.c:116) doesn't be called.)
The text was updated successfully, but these errors were encountered:
Hi, I compiled the 'parse_plpgsql.c' and tested it with file "plpgsql_samples.sql". ASan and valgrind find memory leak in pg_query_parse.c:52
After debugging by gdb, I found it seems 'result.stderr_buffer' doesn't free correctly when parse plpgsql.(seems function pg_query_free_parse_result(pg_query_parse.c:116) doesn't be called.)
The text was updated successfully, but these errors were encountered: