I have a strange (but very real problem). When I call gpgme_op_keylist_start()
or gpgme_get_key() gpgme seems to leak memory (according to valgrind). The
weird part is that when I redirect stdout and stderr to a file (from valgrind)
the leak is no longer reported. I am attaching a simple program that
illustrates the bug (hoping this is user error on my part). To compile it:
g++ simple-signer.cc -o simple-signer -lgpgme-pthread
Valgrind is VERY verbose, but the part the is worrisome here is:
...
4104== 14 bytes in 2 blocks are definitely lost in loss record 1 of 5
4104== at 0x4C22FAB: malloc (vg_replace_malloc.c:207)
4104== by 0x5864DD1: strdup (in /lib/libc-2.7.so)
4104== by 0x4E2DE25: (within /usr/lib/libgpgme-pthread.so.11.6.4)
4104== by 0x4E3A66E: (within /usr/lib/libgpgme-pthread.so.11.6.4)
4104== by 0x4E37206: (within /usr/lib/libgpgme-pthread.so.11.6.4)
4104== by 0x4E3033A: (within /usr/lib/libgpgme-pthread.so.11.6.4)
4104== by 0x4E33FF4: gpgme_op_keylist_start (in
/usr/lib/libgpgme-pthread.so.11.6.4)
4104== by 0x4E342F6: gpgme_get_key (in /usr/lib/libgpgme-pthread.so.11.6.4)
4104== by 0x401986: main (in /home/eoster/giveup/simple-signer)
...
4104== LEAK SUMMARY:
4104== definitely lost: 14 bytes in 2 blocks.
4104== possibly lost: 0 bytes in 0 blocks.
4104== still reachable: 422 bytes in 11 blocks.
4104== suppressed: 0 bytes in 0 blocks.
I have a version of this program that runs in a loop and the number of bytes
lost seems to increase as I repeat these operations.