aboutsummaryrefslogtreecommitdiff
path: root/msg.c
diff options
context:
space:
mode:
Diffstat (limited to 'msg.c')
-rw-r--r--msg.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/msg.c b/msg.c
index a5a86ea..058f669 100644
--- a/msg.c
+++ b/msg.c
@@ -133,12 +133,18 @@ ingest(char **buffer)
unsigned int size = fsize(f);
char *partial_content = fcontent(f, size);
+ char *temp_buffer = malloc(strlen(*buffer) + 1 * sizeof(char));
+ strcpy(temp_buffer, *buffer);
+
+ free(*buffer);
asprintf(buffer,
"%.*s%s%s\n",
match->offset,
- *buffer,
+ temp_buffer,
partial_content,
- *buffer + match->offset + match->length);
+ temp_buffer + match->offset + match->length);
+
+ free(temp_buffer);
}
free(directive);