diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-04-11 12:59:14 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2018-04-11 12:59:14 +0200 |
commit | d2f85600c42a57819dcc35050d4fddd89d2937ce (patch) | |
tree | 49b289c1bfd26f4ca2e428961223b40591f50ff6 /openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c | |
parent | 29d922d4605e313a47301287efe3ca30edd99b05 (diff) |
bsc_nat: ctrl: fix memleak on reply receival
Change-Id: I146c4a561b0cd62779d60da3b55b96e24438bd89
Diffstat (limited to 'openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c')
-rw-r--r-- | openbsc/src/osmo-bsc_nat/bsc_nat_ctrl.c | 7 |
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 { |