test de memoria me da error en los 4 casos, pero sin embargo archivo que genera me dice que no hay errores y toda la memoria fue liberada:
==8992== Memcheck, a memory error detector
==8992== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==8992== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==8992== Command: ./decodificar
==8992==
==8992==
==8992== HEAP SUMMARY:
==8992== in use at exit: 0 bytes in 0 blocks
==8992== total heap usage: 6 allocs, 6 frees, 9,224 bytes allocated
==8992==
==8992== All heap blocks were freed -- no leaks are possible
==8992==
==8992== For lists of detected and suppressed errors, rerun with: -s
==8992== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)