I am trying to test a code which basically tries to read some data from postgresql db in a loop through a function SQL_get_tpf_rw() whose definition and other details are shared in the attached file along with the memory leak report resulted during testing. Could you let me know if i missed calling anywhere PQclear()
Direct leak of 197920 byte(s) in 1237 object(s) allocated from: #0 0xf79e300b in __interceptor_malloc (/nix/store/7z4l4r0kpgzvsi6zkjz52cvgb8ra06bd-gcc-12.2.0-lib/lib/libasan.so.8+0xbe00b) #1 0xf78dd3f3 in PQmakeEmptyPGresult (/nix/store/y03rfw0iycp00dxcf8vrmss4nj700fia-postgresql-14.9-lib/lib/libpq.so.5+0x113f3)
Indirect leak of 2525184 byte(s) in 1233 object(s) allocated from: #0 0xf79e300b in __interceptor_malloc (/nix/store/7z4l4r0kpgzvsi6zkjz52cvgb8ra06bd-gcc-12.2.0-lib/lib/libasan.so.8+0xbe00b) #1 0xf78dd04c in pqResultAlloc (/nix/store/y03rfw0iycp00dxcf8vrmss4nj700fia-postgresql-14.9-lib/lib/libpq.so.5+0x1104c)
Indirect leak of 632832 byte(s) in 1236 object(s) allocated from: #0 0xf79e300b in __interceptor_malloc (/nix/store/7z4l4r0kpgzvsi6zkjz52cvgb8ra06bd-gcc-12.2.0-lib/lib/libasan.so.8+0xbe00b) #1 0xf78dc7e0 in pqAddTuple (/nix/store/y03rfw0iycp00dxcf8vrmss4nj700fia-postgresql-14.9-lib/lib/libpq.so.5+0x107e0)
SUMMARY: AddressSanitizer: 3355936 byte(s) leaked in 3706 allocation(s).