X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fmustach.c;h=03f3cb1f1a010fa2547fdf8e7c02d63055292405;hb=ba9ab1c5bb62fd849423509b918d494888a87a38;hp=19df16fc4492d051d9909d0165ea244d4885106f;hpb=1d4de11a907e41c06063a2cd5028dc4101690f50;p=src%2Fapp-framework-main.git diff --git a/src/mustach.c b/src/mustach.c index 19df16f..03f3cb1 100644 --- a/src/mustach.c +++ b/src/mustach.c @@ -47,7 +47,7 @@ static int getpartial(struct mustach_itf *itf, void *closure, const char *name, rc = fputc(0, file) ? MUSTACH_ERROR_SYSTEM : 0; fclose(file); if (rc < 0) { - free(result); + free(*result); *result = NULL; } } @@ -76,11 +76,11 @@ static int process(const char *template, struct mustach_itf *itf, void *closure, } if (emit) fwrite(template, (size_t)(beg - template), 1, file); - term = strstr(template, clstr); + beg += oplen; + term = strstr(beg, clstr); if (term == NULL) return MUSTACH_ERROR_UNEXPECTED_END; template = term + cllen; - beg += oplen; len = (size_t)(term - beg); c = *beg; switch(c) {