port-serial: plug memleak on error processing

==28664== 216 (120 direct, 96 indirect) bytes in 5 blocks are definitely lost in loss record 4,109 of 4,317
    ==28664==    at 0x4C2BEEF: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==28664==    by 0x644E018: g_malloc (in /usr/lib/libglib-2.0.so.0.5200.2)
    ==28664==    by 0x6465B05: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.5200.2)
    ==28664==    by 0x6469C32: g_string_sized_new (in /usr/lib/libglib-2.0.so.0.5200.2)
    ==28664==    by 0x4D7861: parse_response (mm-port-serial-at.c:142)
    ==28664==    by 0x4D3B52: parse_response_buffer (mm-port-serial.c:857)
    ==28664==    by 0x4D40F2: common_input_available (mm-port-serial.c:981)
    ==28664==    by 0x4D41B4: iochannel_input_available (mm-port-serial.c:1004)
    ==28664==    by 0x64488B4: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.5200.2)
    ==28664==    by 0x6448C77: ??? (in /usr/lib/libglib-2.0.so.0.5200.2)
    ==28664==    by 0x6448F91: g_main_loop_run (in /usr/lib/libglib-2.0.so.0.5200.2)
    ==28664==    by 0x438035: main (main.c:180)
This commit is contained in:
Aleksander Morgado
2017-07-18 11:28:33 +02:00
parent fa31b699ec
commit bad79cb5e1

View File

@@ -157,6 +157,7 @@ parse_response (MMPortSerial *port,
/* If we got an error, propagate it without any further response string */ /* If we got an error, propagate it without any further response string */
if (inner_error) { if (inner_error) {
g_string_free (string, TRUE);
g_propagate_error (error, inner_error); g_propagate_error (error, inner_error);
return MM_PORT_SERIAL_RESPONSE_ERROR; return MM_PORT_SERIAL_RESPONSE_ERROR;
} }