aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-04-11 12:59:14 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-04-11 12:59:14 +0200
commitd2f85600c42a57819dcc35050d4fddd89d2937ce (patch)
tree49b289c1bfd26f4ca2e428961223b40591f50ff6 /openbsc
parent29d922d4605e313a47301287efe3ca30edd99b05 (diff)
bsc_nat: ctrl: fix memleak on reply receival
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
index 128ea6518..738ac8765 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c
@@ -102,7 +102,7 @@ int bsc_nat_handle_ctrlif_msg(struct bsc_connection *bsc, struct msgb *msg)
{
struct ctrl_cmd *cmd;
struct bsc_cmd_list *pending;
- char *var, *id;
+ char *var;
cmd = ctrl_cmd_parse(bsc, msg);
msgb_free(msg);
@@ -142,13 +142,12 @@ int bsc_nat_handle_ctrlif_msg(struct bsc_connection *bsc, struct msgb *msg)
/* Find the pending command */
pending = bsc_get_pending(bsc, cmd->id);
if (pending) {
- id = talloc_strdup(cmd, pending->cmd->id);
- if (!id) {
+ osmo_talloc_replace_string(cmd, &cmd->id, pending->cmd->id);
+ if (!cmd->id) {
cmd->type = CTRL_TYPE_ERROR;
cmd->reply = "OOM";
goto err;
}
- cmd->id = id;
ctrl_cmd_send(&pending->ccon->write_queue, cmd);
bsc_nat_ctrl_del_pending(pending);
} else {