mirror of
https://github.com/troglobit/libite.git
synced 2026-11-06 15:50:57 +00:00
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:
1 parent
a7b5c240c1
commit
ca53e097c3
1 file changed
+3
-2
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user