misc: Fix a potential leak on config parsing

Fixes: Coverity CID 1040949
This commit is contained in:
Holger Hans Peter Freyther 2013-11-11 20:12:30 +01:00
parent 0e0f2f5faf
commit 4e8b50cd8d
1 changed files with 2 additions and 1 deletions

View File

@ -37,7 +37,7 @@ extern "C" {
extern struct gprs_nsvc *nsvc;
uint16_t spoof_mcc = 0, spoof_mnc = 0;
static int config_given = 0;
static const char *config_file = "osmo-pcu.cfg";
static char *config_file = strdup("osmo-pcu.cfg");
extern struct vty_app_info pcu_vty_info;
void *tall_pcu_ctx;
extern void *bv_tall_ctx;
@ -91,6 +91,7 @@ static void handle_options(int argc, char **argv)
exit(0);
break;
case 'c':
free(config_file);
config_file = strdup(optarg);
config_given = 1;
break;