rc = fputc(0, file) ? MUSTACH_ERROR_SYSTEM : 0;
fclose(file);
if (rc < 0) {
- free(result);
+ free(*result);
*result = NULL;
}
}
}
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) {