summaryrefslogtreecommitdiffstats
path: root/fb-helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'fb-helper.c')
-rw-r--r--fb-helper.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fb-helper.c b/fb-helper.c
index 6e2a7fb..b550887 100644
--- a/fb-helper.c
+++ b/fb-helper.c
@@ -68,11 +68,13 @@ int load_file(const char *fn, char **data, size_t *data_size)
/* read the file in buf_size chunks and appened the data to *data */
while (!feof(fp)) {
- *data = realloc(*data, *data_size + buf_size);
- if (*data == NULL) {
+ char *tmp;
+ tmp = realloc(*data, *data_size + buf_size);
+ if (tmp == NULL) {
perror("load_file");
return 1;
}
+ *data = tmp;
*data_size += fread(*data + *data_size, sizeof(char), buf_size, fp);