Thread original: sisoputnfrba/foro#2462 (comment)
Resulta que el error de points to uninitialised byte(s) no aparece en el momento si se copia memoria sin inicializar usando memcpy, sino que lo hace recién cuando se intenta acceder, ya sea desde esa variable como de la copia.
Ejemplo:
int main() {
int a, b;
memcpy(&b, &a, sizeof a);
return b;
}==152049== Memcheck, a memory error detector
==152049== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==152049== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==152049== Command: ./main
==152049==
==152049== Syscall param exit_group(status) contains uninitialised byte(s)
==152049== at 0x49452C6: _Exit (_exit.c:31)
==152049== by 0x48A8B41: __run_exit_handlers (exit.c:132)
==152049== by 0x48A8BDF: exit (exit.c:139)
==152049== by 0x48860B9: (below main) (libc-start.c:342)
==152049==
==152049==
==152049== HEAP SUMMARY:
==152049== in use at exit: 0 bytes in 0 blocks
==152049== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==152049==
==152049== All heap blocks were freed -- no leaks are possible
==152049==
==152049== Use --track-origins=yes to see where uninitialised values come from
==152049== For lists of detected and suppressed errors, rerun with: -s
==152049== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Para corregir esto, podemos usar la opción que nos sugiere Valgrind al final del log:
Use --track-origins=yes to see where uninitialised values come from