This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/18704 )
Change subject: osmo-bts-trx/trx_if: fix memleak in trx_ctrl_cmd_cb()
......................................................................
osmo-bts-trx/trx_if: fix memleak in trx_ctrl_cmd_cb()
If we do not enqueue a TRXC message, we should release memory.
Change-Id: Ie2cdf547befbc0fafdb82b10b45ad85a9b188b88
---
M src/osmo-bts-trx/trx_if.c
1 file changed, 12 insertions(+), 11 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/04/18704/1
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index f717a0c..488aff6 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -211,9 +211,6 @@
struct trx_ctrl_msg *tcm;
struct trx_ctrl_msg *prev = NULL;
va_list ap;
- int pending;
-
- pending = !llist_empty(&l1h->trx_ctrl_list);
/* create message */
tcm = talloc_zero(tall_bts_ctx, struct trx_ctrl_msg);
@@ -236,18 +233,22 @@
tcm->cb = cb;
/* Avoid adding consecutive duplicate messages, eg: two consecutive POWEROFF */
- if(pending)
+ if (!llist_empty(&l1h->trx_ctrl_list))
prev = llist_entry(l1h->trx_ctrl_list.prev, struct trx_ctrl_msg, list);
-
- if (!pending ||
- !(strcmp(tcm->cmd, prev->cmd) == 0 && strcmp(tcm->params, prev->params) == 0)) {
- LOGPPHI(l1h->phy_inst, DTRX, LOGL_INFO, "Enqueuing TRX control command 'CMD %s%s%s'\n",
- tcm->cmd, tcm->params_len ? " ":"", tcm->params);
- llist_add_tail(&tcm->list, &l1h->trx_ctrl_list);
+ if (prev != NULL && !strcmp(tcm->cmd, prev->cmd)
+ && !strcmp(tcm->params, prev->params)) {
+ LOGPPHI(l1h->phy_inst, DTRX, LOGL_DEBUG,
+ "Not sending duplicate command '%s'\n", tcm->cmd);
+ talloc_free(tcm);
+ return 0;
}
+ LOGPPHI(l1h->phy_inst, DTRX, LOGL_INFO, "Enqueuing TRX control command 'CMD %s%s%s'\n",
+ tcm->cmd, tcm->params_len ? " " : "", tcm->params);
+ llist_add_tail(&tcm->list, &l1h->trx_ctrl_list);
+
/* send message, if we didn't already have pending messages */
- if (!pending)
+ if (prev == NULL)
trx_ctrl_send(l1h);
return 0;
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/18704
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ie2cdf547befbc0fafdb82b10b45ad85a9b188b88
Gerrit-Change-Number: 18704
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200606/b86565d6/attachment.htm>