Make sure the old value in `scsi_target->wwpn` is free'd before replacing it. ==9104== 38 bytes in 2 blocks are definitely lost in loss record 1,943 of 3,250 ==9104== at 0x483B8C0: malloc (vg_replace_malloc.c:442) ==9104== by 0x4DFB69B: g_malloc (gmem.c:130) ==9104== by 0x4E1921D: g_strdup (gstrfuncs.c:363) ==9104== by 0x495D60B: g_strdup_inline (gstrfuncs.h:321) ==9104== by 0x495D60B: virFCReadRportValue (virfcp.c:62) ==9104== by 0x4A5F5CB: virNodeDeviceGetSCSITargetCaps (node_device_conf.c:2914) ==9104== by 0xBF62529: udevProcessSCSITarget (node_device_udev.c:657) ==9104== by 0xBF62529: udevGetDeviceDetails (node_device_udev.c:1406) ==9104== by 0xBF62529: udevAddOneDevice (node_device_udev.c:1563) ==9104== by 0xBF639B5: udevProcessDeviceListEntry (node_device_udev.c:1637) ==9104== by 0xBF639B5: udevEnumerateDevices (node_device_udev.c:1691) ==9104== by 0xBF639B5: nodeStateInitializeEnumerate (node_device_udev.c:2009) ==9104== by 0x49BDBFD: virThreadHelper (virthread.c:256) ==9104== by 0x5242069: start_thread (in /usr/lib64/libc.so.6) Signed-off-by: Marc Hartmayer <mhartmay@xxxxxxxxxxxxx> --- src/conf/node_device_conf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 32b69aae84f3..14504cbb9c1f 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -2897,6 +2897,7 @@ virNodeDeviceGetSCSITargetCaps(const char *sysfsPath, int ret = -1; g_autofree char *dir = NULL; g_autofree char *rport = NULL; + g_autofree char *wwpn = NULL; VIR_DEBUG("Checking if '%s' is an FC remote port", scsi_target->name); @@ -2912,11 +2913,13 @@ virNodeDeviceGetSCSITargetCaps(const char *sysfsPath, scsi_target->rport = g_steal_pointer(&rport); if (virFCReadRportValue(scsi_target->rport, "port_name", - &scsi_target->wwpn) < 0) { + &wwpn) < 0) { VIR_WARN("Failed to read port_name for '%s'", scsi_target->rport); goto cleanup; } + VIR_FREE(scsi_target->wwpn); + scsi_target->wwpn = g_steal_pointer(&wwpn); scsi_target->flags |= VIR_NODE_DEV_CAP_FLAG_FC_RPORT; ret = 0; base-commit: b902cfece0db71c3421b0bfe0e05d1dbe7890c31 -- 2.34.1 _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx