aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-02-08 09:25:38 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-02-08 09:25:38 +0100
commit60e073e28d5e52f8eb4feaa422abc71b8b9f831b (patch)
treed72285138135a43cf6c1e915d7869ca0b38b6ea5 /openbsc
parent019851a5238e95dd1a089d19d966973b5a61f568 (diff)
nat: getopt returns "static" data no need to copy it
I used strdup in case the data would not be valid from after the call to getopt and this creates a potential leak if a user is specifying multiple configuration files. If I depend on the fact that the string is a pointer into the argv[] array I can kill the strdup and fix the unlikely leak. Fixes: Coverity CID 1206578
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/osmo-bsc_nat/bsc_nat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c
index dcc30ca8c..6b061bc20 100644
--- a/openbsc/src/osmo-bsc_nat/bsc_nat.c
+++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c
@@ -1415,7 +1415,7 @@ static void handle_options(int argc, char **argv)
daemonize = 1;
break;
case 'c':
- config_file = strdup(optarg);
+ config_file = optarg;
break;
case 'T':
log_set_print_timestamp(osmo_stderr_target, 1);