Skip to content

kernel-device-generic: plug memleak when processing platform ports

ptr_array_add_sysfs_attribute_link_basename() already reads the current subsystem, so we should avoid overwriting the pointer.

  ==1630== 13 bytes in 2 blocks are definitely lost in loss record 270 of 3,092
  ==1630==    at 0x4842839: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
  ==1630==    by 0x4A1DDE8: g_malloc (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==1630==    by 0x4A329E3: g_strdup (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.6800.1)
  ==1630==    by 0x26128E: ptr_array_add_sysfs_attribute_link_basename (mm-kernel-device-generic.c:244)
  ==1630==    by 0x263FD0: preload_contents_platform (mm-kernel-device-generic.c:314)
  ==1630==    by 0x263FD0: preload_contents (mm-kernel-device-generic.c:549)
  ==1630==    by 0x263FD0: check_preload (mm-kernel-device-generic.c:992)
  ==1630==    by 0x263FD0: initable_init (mm-kernel-device-generic.c:1139)
  ==1630==    by 0x4B6DDB9: g_initable_new_valist (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6800.1)
  ==1630==    by 0x4B6DE6C: g_initable_new (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6800.1)
  ==1630==    by 0x262087: mm_kernel_device_generic_new_with_rules (mm-kernel-device-generic.c:1054)
  ==1630==    by 0x17F66F: handle_kernel_event (mm-base-manager.c:689)
  ==1630==    by 0x17F7D2: report_kernel_event_auth_ready (mm-base-manager.c:1238)
  ==1630==    by 0x4BA37D8: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6800.1)
  ==1630==    by 0x4BA3A1A: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.6800.1)
Edited by Aleksander Morgado

Merge request reports

Loading