mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 18:40:09 +01:00
core/lldp: fix memleak in _lldp_attr_take_str_ptr()
Valgrind complains: ==26355== 32 bytes in 2 blocks are definitely lost in loss record 2,829 of 6,716 ==26355== at 0x4838748: malloc (vg_replace_malloc.c:308) ==26355== by 0x483AD63: realloc (vg_replace_malloc.c:836) ==26355== by 0x4F6AD4F: g_realloc (in /usr/lib64/libglib-2.0.so.0.6000.6) ==26355== by 0x4F87B33: ??? (in /usr/lib64/libglib-2.0.so.0.6000.6) ==26355== by 0x4F87B96: g_string_sized_new (in /usr/lib64/libglib-2.0.so.0.6000.6) ==26355== by 0x2D66E1: nm_utils_buf_utf8safe_escape (nm-shared-utils.c:1911) ==26355== by 0x4113B0: lldp_neighbor_new (nm-lldp-listener.c:676) ==26355== by 0x412788: process_lldp_neighbor (nm-lldp-listener.c:882) ==26355== by 0x4135CF: lldp_event_handler (nm-lldp-listener.c:931) ==26355== by 0x422CDB: lldp_callback (sd-lldp.c:50) ==26355== by 0x4235F9: lldp_add_neighbor (sd-lldp.c:166) ==26355== by 0x423679: lldp_handle_datagram (sd-lldp.c:189) ==26355== by 0x423C8B: lldp_receive_datagram (sd-lldp.c:235) ==26355== by 0x2F887A: source_dispatch (sd-event.c:2832) ==26355== by 0x2FAD43: sd_event_dispatch (sd-event.c:3245) ==26355== by 0x2D9237: event_dispatch (nm-sd.c:51) ==26355== by 0x4F64EDC: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.6000.6) ==26355== by 0x4F6526F: ??? (in /usr/lib64/libglib-2.0.so.0.6000.6) ==26355== by 0x4F655A2: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.6000.6) ==26355== by 0x140932: main (main.c:465) ==26355== (cherry picked from commitece270ea5f) (cherry picked from commit273f0b5416)
This commit is contained in:
parent
a1f39b69e0
commit
5233a02e28
1 changed files with 3 additions and 1 deletions
|
|
@ -233,8 +233,10 @@ _lldp_attr_take_str_ptr (LldpAttrData *pdata, LldpAttrId attr_id, char *str)
|
|||
pdata = &pdata[attr_id];
|
||||
|
||||
/* we ignore duplicate fields silently. */
|
||||
if (pdata->attr_type != LLDP_ATTR_TYPE_NONE)
|
||||
if (pdata->attr_type != LLDP_ATTR_TYPE_NONE) {
|
||||
g_free (str);
|
||||
return;
|
||||
}
|
||||
|
||||
pdata->attr_type = LLDP_ATTR_TYPE_STRING;
|
||||
pdata->v_string = str;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue