VTY: cosmetic: use osmo_talloc_replace_string()
Change-Id: Id09c7d24b48ddecfa96404c3e75330465a11f830
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index 1f46707..afc8a9b 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <string.h>
#include <osmocom/core/tdef.h>
+#include <osmocom/core/utils.h>
#include <osmocom/vty/tdef_vty.h>
#include <osmocom/vty/logging.h>
#include <osmocom/vty/stats.h>
@@ -1100,10 +1101,7 @@
if (vty->type != VTY_FILE)
vty_out(vty, "Changing PCU socket path at run-time has no effect%s", VTY_NEWLINE);
- if (bts->pcu_sock_path) {
- talloc_free(bts->pcu_sock_path);
- }
- bts->pcu_sock_path = talloc_strdup(tall_pcu_ctx, argv[0]);
+ osmo_talloc_replace_string(tall_pcu_ctx, &bts->pcu_sock_path, argv[0]);
return CMD_SUCCESS;
}