pass the UID as string to key diversification because that is the way we get it from libfreefare
reminder that we might want to do this
prefix the helper too
print the parsed sysid
print the intermediate key bytes for debugging
re-auth with ACL read key
read ACL file
reading membership-id file
typo fix
tried to do something about the leak triggered by nfc_list_devices
note about the timeout
exmaple of using pthreads for timeoutable tasks
timeouts with pthreads but seems to leak

==10602== HEAP SUMMARY:
==10602==     in use at exit: 1,632 bytes in 6 blocks
==10602==   total heap usage: 736 allocs, 730 frees, 79,777 bytes
allocated
==10602==
==10602== Searching for pointers to 6 not-freed blocks
==10602== Checked 50,497,256 bytes
==10602==
==10602== 1,632 bytes in 6 blocks are possibly lost in loss record 1
of 1
==10602==    at 0x4C2CC70: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10602==    by 0x4012E54: _dl_allocate_tls (dl-tls.c:296)
==10602==    by 0x5650DA0: pthread_create@@GLIBC_2.2.5
(allocatestack.c:589)
==10602==    by 0x4021CC: main (read_personalized.c:320)
==10602==
==10602== LEAK SUMMARY:
==10602==    definitely lost: 0 bytes in 0 blocks
==10602==    indirectly lost: 0 bytes in 0 blocks
==10602==      possibly lost: 1,632 bytes in 6 blocks
==10602==    still reachable: 0 bytes in 0 blocks
==10602==         suppressed: 0 bytes in 0 blocks
==10602==
==10602== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
==10602== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
need to call pthread exit, not return null
use phtread exit on the example too, but it too (possibly) leaks memory...

do_or_timeout: calculation timed out
--10711-- REDIR: 0x50d8870 (free) redirected to 0x4c2bd80 (free)
==10711==
==10711== HEAP SUMMARY:
==10711==     in use at exit: 272 bytes in 1 blocks
==10711==   total heap usage: 1 allocs, 0 frees, 272 bytes allocated
==10711==
==10711== Searching for pointers to 1 not-freed blocks
==10711== Checked 8,489,608 bytes
==10711==
==10711== 272 bytes in 1 blocks are possibly lost in loss record 1 of 1
==10711==    at 0x4C2CC70: calloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10711==    by 0x4012E54: _dl_allocate_tls (dl-tls.c:296)
==10711==    by 0x4E3FDA0: pthread_create@@GLIBC_2.2.5
(allocatestack.c:589)
==10711==    by 0x400942: do_or_timeout (pthread_example.c:42)
==10711==    by 0x4009C6: main (pthread_example.c:66)
==10711==
==10711== LEAK SUMMARY:
==10711==    definitely lost: 0 bytes in 0 blocks
==10711==    indirectly lost: 0 bytes in 0 blocks
==10711==      possibly lost: 272 bytes in 1 blocks
==10711==    still reachable: 0 bytes in 0 blocks
==10711==         suppressed: 0 bytes in 0 blocks
==10711==
==10711== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
==10711== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
this is the correct way to clean up timed out thread, it seems...
cleaner way (also works when the infite loop is commented out)
no leaks, yay!
do not leak memory even when we have glitch-induced timeout in handle_tag
remove dead code, improve comments, add sanity-checks and defensive programming