[S] Change in osmo-e1d[master]: Prevent memory leaks / double free of msgb in proto_clnt.c
laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/35609?usp=email ) Change subject: Prevent memory leaks / double free of msgb in proto_clnt.c .. Prevent memory leaks / double free of msgb in proto_clnt.c Change-Id: Ic0c4c06ba7c1a405ec3c73100fe9e8476f4f5512 --- M src/proto_clnt.c 1 file changed, 24 insertions(+), 3 deletions(-) Approvals: Jenkins Builder: Verified tnt: Looks good to me, approved laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve diff --git a/src/proto_clnt.c b/src/proto_clnt.c index 854b958..cfa9ca2 100644 --- a/src/proto_clnt.c +++ b/src/proto_clnt.c @@ -190,10 +190,13 @@ } rc = osmo_e1dp_send(>ctl_fd, msgb, -1); - if (rc < 0) + if (rc < 0) { + msgb_free(msgb); return rc; + } msgb_free(msgb); + msgb = NULL; /* Response */ int flags = fcntl(clnt->ctl_fd.fd, F_GETFL, 0); @@ -386,8 +389,10 @@ if (rc) return rc; - if (msgb_l2len(msgb) != sizeof(struct osmo_e1dp_line_info)) + if (msgb_l2len(msgb) != sizeof(struct osmo_e1dp_line_info)) { + msgb_free(msgb); return -EPIPE; + } msgb_free(msgb); @@ -417,6 +422,11 @@ if (rc) return rc; + if (msgb_l2len(msgb) != 0) { + msgb_free(msgb); + return -EPIPE; + } + msgb_free(msgb); return 0; @@ -449,8 +459,10 @@ if (rc) return rc; - if ((tsfd < 0) || (msgb_l2len(msgb) != sizeof(struct osmo_e1dp_ts_info))) + if ((tsfd < 0) || (msgb_l2len(msgb) != sizeof(struct osmo_e1dp_ts_info))) { + msgb_free(msgb); return -EPIPE; + } msgb_free(msgb); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35609?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Ic0c4c06ba7c1a405ec3c73100fe9e8476f4f5512 Gerrit-Change-Number: 35609 Gerrit-PatchSet: 3 Gerrit-Owner: jolly Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Reviewer: tnt Gerrit-MessageType: merged
[S] Change in osmo-e1d[master]: Prevent memory leaks / double free of msgb in proto_clnt.c
Attention is currently required from: jolly. laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/35609?usp=email ) Change subject: Prevent memory leaks / double free of msgb in proto_clnt.c .. Patch Set 3: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35609?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Ic0c4c06ba7c1a405ec3c73100fe9e8476f4f5512 Gerrit-Change-Number: 35609 Gerrit-PatchSet: 3 Gerrit-Owner: jolly Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Reviewer: tnt Gerrit-Attention: jolly Gerrit-Comment-Date: Fri, 19 Jan 2024 19:43:59 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[S] Change in osmo-e1d[master]: Prevent memory leaks / double free of msgb in proto_clnt.c
Attention is currently required from: jolly. Hello Jenkins Builder, pespin, tnt, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/osmo-e1d/+/35609?usp=email to look at the new patch set (#3). The following approvals got outdated and were removed: Verified+1 by Jenkins Builder The change is no longer submittable: Verified is unsatisfied now. Change subject: Prevent memory leaks / double free of msgb in proto_clnt.c .. Prevent memory leaks / double free of msgb in proto_clnt.c Change-Id: Ic0c4c06ba7c1a405ec3c73100fe9e8476f4f5512 --- M src/proto_clnt.c 1 file changed, 24 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/09/35609/3 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35609?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Ic0c4c06ba7c1a405ec3c73100fe9e8476f4f5512 Gerrit-Change-Number: 35609 Gerrit-PatchSet: 3 Gerrit-Owner: jolly Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin Gerrit-Reviewer: tnt Gerrit-Attention: jolly Gerrit-MessageType: newpatchset
[S] Change in osmo-e1d[master]: Prevent memory leaks / double free of msgb in proto_clnt.c
Attention is currently required from: jolly. tnt has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/35609?usp=email ) Change subject: Prevent memory leaks / double free of msgb in proto_clnt.c .. Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35609?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Ic0c4c06ba7c1a405ec3c73100fe9e8476f4f5512 Gerrit-Change-Number: 35609 Gerrit-PatchSet: 2 Gerrit-Owner: jolly Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin Gerrit-Reviewer: tnt Gerrit-Attention: jolly Gerrit-Comment-Date: Thu, 18 Jan 2024 15:34:30 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[S] Change in osmo-e1d[master]: Prevent memory leaks / double free of msgb in proto_clnt.c
Attention is currently required from: jolly. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-e1d/+/35609?usp=email ) Change subject: Prevent memory leaks / double free of msgb in proto_clnt.c .. Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35609?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Ic0c4c06ba7c1a405ec3c73100fe9e8476f4f5512 Gerrit-Change-Number: 35609 Gerrit-PatchSet: 2 Gerrit-Owner: jolly Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin Gerrit-Attention: jolly Gerrit-Comment-Date: Thu, 18 Jan 2024 13:15:22 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[S] Change in osmo-e1d[master]: Prevent memory leaks / double free of msgb in proto_clnt.c
jolly has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/35609?usp=email ) Change subject: Prevent memory leaks / double free of msgb in proto_clnt.c .. Prevent memory leaks / double free of msgb in proto_clnt.c Change-Id: Ic0c4c06ba7c1a405ec3c73100fe9e8476f4f5512 --- M src/proto_clnt.c 1 file changed, 24 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/09/35609/1 diff --git a/src/proto_clnt.c b/src/proto_clnt.c index 854b958..cfa9ca2 100644 --- a/src/proto_clnt.c +++ b/src/proto_clnt.c @@ -190,10 +190,13 @@ } rc = osmo_e1dp_send(>ctl_fd, msgb, -1); - if (rc < 0) + if (rc < 0) { + msgb_free(msgb); return rc; + } msgb_free(msgb); + msgb = NULL; /* Response */ int flags = fcntl(clnt->ctl_fd.fd, F_GETFL, 0); @@ -386,8 +389,10 @@ if (rc) return rc; - if (msgb_l2len(msgb) != sizeof(struct osmo_e1dp_line_info)) + if (msgb_l2len(msgb) != sizeof(struct osmo_e1dp_line_info)) { + msgb_free(msgb); return -EPIPE; + } msgb_free(msgb); @@ -417,6 +422,11 @@ if (rc) return rc; + if (msgb_l2len(msgb) != 0) { + msgb_free(msgb); + return -EPIPE; + } + msgb_free(msgb); return 0; @@ -449,8 +459,10 @@ if (rc) return rc; - if ((tsfd < 0) || (msgb_l2len(msgb) != sizeof(struct osmo_e1dp_ts_info))) + if ((tsfd < 0) || (msgb_l2len(msgb) != sizeof(struct osmo_e1dp_ts_info))) { + msgb_free(msgb); return -EPIPE; + } msgb_free(msgb); -- To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35609?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-e1d Gerrit-Branch: master Gerrit-Change-Id: Ic0c4c06ba7c1a405ec3c73100fe9e8476f4f5512 Gerrit-Change-Number: 35609 Gerrit-PatchSet: 1 Gerrit-Owner: jolly Gerrit-MessageType: newchange