Skip to contentSkip to conversation

Memory leak if failed to do RTPG.

PATCH In review Konrad Rzeszutek 2 participants 2 messages Apr 8, 2009 – Nov 3, 2010 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Memory leak if failed to do RTPG.

We don't de-alloc the buf variable if we fail on the first do_rtpg call.

---
 libmultipath/prioritizers/alua_rtpg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
libmultipath/prioritizers/alua_rtpg.c +1 -1
index 7151cdd..5a8a59f 100644
@@ -263,7 +263,7 @@ get_asymmetric_access_state(int fd, unsigned int tpg)
 	}
 	rc = do_rtpg(fd, buf, buflen);
 	if (rc < 0)
-		return rc;
+		goto out;
 	scsi_buflen = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
 	if (buflen < (scsi_buflen + 4)) {
 		free(buf);
Signature · 1 line
1.5.4.1
#1 lore raw

This patch is still queued in dm-devel's patchwork and is still relevant to upstream's multipath-tools:
https://patchwork.kernel.org/patch/17280/

Quoted 26 lines · Konrad Rzeszutek

We don't de-alloc the buf variable if we fail on the first do_rtpg call.

---
 libmultipath/prioritizers/alua_rtpg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
libmultipath/prioritizers/alua_rtpg.c +1 -1
index 7151cdd..5a8a59f 100644
@@ -263,7 +263,7 @@ get_asymmetric_access_state(int fd, unsigned int tpg)
 	}
 	rc = do_rtpg(fd, buf, buflen);
 	if (rc < 0)
-		return rc;
+		goto out;
 	scsi_buflen = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
 	if (buflen < (scsi_buflen + 4)) {
 		free(buf);
Signature · 6 lines
1.5.4.1

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel