summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hcid/main.c2
-rw-r--r--hcid/parser.y12
2 files changed, 9 insertions, 5 deletions
diff --git a/hcid/main.c b/hcid/main.c
index dd3367b7..567dfab3 100644
--- a/hcid/main.c
+++ b/hcid/main.c
@@ -80,7 +80,7 @@ struct device_opts *alloc_device_opts(char *ref)
exit(1);
}
- device->ref = ref;
+ device->ref = strdup(ref);
device->next = device_list;
device_list = device;
diff --git a/hcid/parser.y b/hcid/parser.y
index aae915e9..cf947fbf 100644
--- a/hcid/parser.y
+++ b/hcid/parser.y
@@ -50,6 +50,8 @@ int yyparse(void);
int yylex(void);
int yyerror(char *s);
+void yylex_destroy(void);
+
%}
%union {
@@ -221,23 +223,23 @@ device_opt:
dev_name:
WORD {
- $$ = strdup($1);
+ $$ = $1;
}
| STRING {
- $$ = strdup($1);
+ $$ = $1;
}
;
hci:
HCI {
- $$ = strdup($1);
+ $$ = $1;
}
;
bdaddr:
BDADDR {
- $$ = strdup($1);
+ $$ = $1;
}
;
@@ -329,5 +331,7 @@ int read_config(char *file)
fclose(yyin);
+ yylex_destroy();
+
return 0;
}