diff options
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -117,12 +117,14 @@ static int try_to_xslt_open_csv(const char *filename, struct memblock *mem, char */ buf = realloc(mem->buffer, mem->size + strlen("<csv></csv>")); if (buf != NULL) { - memmove(buf + 5, mem->buffer, mem->size); + memmove(buf + 5, buf, mem->size); memcpy(buf, "<csv>", 5); - memcpy(mem->buffer + mem->size + 5, "</csv>", 7); - mem->buffer = buf; + memcpy(buf + mem->size + 5, "</csv>", 7); mem->size += strlen("<csv></csv>"); + mem->buffer = buf; } else { + /* we can atleast try to strdup a error... */ + *error = strdup("realloc failed in __func__\n"); free(mem->buffer); return 1; } |