lfile: Initialize strtok_r() save pointer

Must initialize the save pointer in the parser context, otherwise
strtok_r() will fail on statically built embedded targets.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2015-10-26 00:16:36 +01:00
parent a7b5c240c1
commit ca53e097c3
+3 -2
View File
@@ -47,8 +47,9 @@ lfile_t *lfopen(char *file, char *sep)
/* Use calloc for clearing buf on behalf of lftok() */
lf = calloc(sizeof(*lf), sizeof(char));
if (lf) {
lf->fp = fopen(file, "r");
lf->sep = sep;
lf->fp = fopen(file, "r");
lf->sep = sep;
lf->save = lf->buf;
if (!lf->fp) {
free(lf);