ndef was freed before ndef->data.
Invalid read of size 8
at 0x41CF58: push_ndef (device.c:287)
by 0x40B850: process_message.isra.4 (object.c:285)
by 0x5143C40: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
by 0x5135B0F: dbus_connection_dispatch (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
by 0x409247: message_dispatch (mainloop.c:76)
by 0x4E7A91A: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x4E79D52: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x4E7A09F: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x4E7A499: g_main_loop_run (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x408D8E: main (main.c:221)
Address 0x6847fb0 is 16 bytes inside a block of size 24 free'd
at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x41CF57: push_ndef (device.c:286)
by 0x40B850: process_message.isra.4 (object.c:285)
by 0x5143C40: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
by 0x5135B0F: dbus_connection_dispatch (in /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8)
by 0x409247: message_dispatch (mainloop.c:76)
by 0x4E7A91A: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x4E79D52: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x4E7A09F: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x4E7A499: g_main_loop_run (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.3200.3)
by 0x408D8E: main (main.c:221)
if (err < 0)
goto error;
- g_free(ndef);
g_free(ndef->data);
+ g_free(ndef);
return NULL;