summaryrefslogtreecommitdiff
path: root/kicad
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-25 11:21:56 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-25 11:21:56 -0300
commite39184fb1ecf18d7776f07eabc02e72a94d17fdb (patch)
treed9249643c8f711a38fe76396709cf4a4bb56329c /kicad
parent69b0d987110ea80237d1896a05bbd3c4c3c80b08 (diff)
downloadeeshow-e39184fb1ecf18d7776f07eabc02e72a94d17fdb.tar.gz
eeshow-e39184fb1ecf18d7776f07eabc02e72a94d17fdb.tar.bz2
eeshow-e39184fb1ecf18d7776f07eabc02e72a94d17fdb.zip
kicad/ext.c (classify_files): play it safe and stralloc strings
This prevents problems in case the argument list disappears, and one doesn't have to distinguish freeing of file_names initialized with classify_files from freeing of file_names returned by pro_parse_file.
Diffstat (limited to 'kicad')
-rw-r--r--kicad/ext.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/kicad/ext.c b/kicad/ext.c
index fe85c44..8f5b64c 100644
--- a/kicad/ext.c
+++ b/kicad/ext.c
@@ -61,25 +61,25 @@ void classify_files(struct file_names *fn, char *const *args,
if (fn->pro)
fatal("%s: there can only be one project",
args[i]);
- fn->pro = args[i];
+ fn->pro = stralloc(args[i]);
break;
case ext_sch:
if (fn->sch)
fatal("%s: there can only be one top sheet",
args[i]);
- fn->sch = args[i];
+ fn->sch = stralloc(args[i]);
break;
case ext_lib:
fn->n_libs++;
fn->libs = realloc_type_n(fn->libs, const char *,
fn->n_libs);
- fn->libs[fn->n_libs - 1] = args[i];
+ fn->libs[fn->n_libs - 1] = stralloc(args[i]);
break;
case ext_pl:
if (fn->pl)
fatal("%s: there can only be one page layout",
args[i]);
- fn->pl = args[i];
+ fn->pl = stralloc(args[i]);
break;
default:
BUG("invalid extension code %d", ext);