aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-03-24 19:10:04 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-03-24 19:10:04 -0400
commit8740cb749d754683b27788d4c1a69f9522b34c82 (patch)
tree13b1952f889f58ad81113371975a060bab0cf954
parent1e46672463d56acc6d64bcc0ec393b7f0ee50889 (diff)
downloadstasis-8740cb749d754683b27788d4c1a69f9522b34c82.tar.gz
Fix realloc error handling
-rw-r--r--src/template.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/template.c b/src/template.c
index 72c045b..8e9904e 100644
--- a/src/template.c
+++ b/src/template.c
@@ -90,8 +90,9 @@ static int grow(size_t z, size_t *output_bytes, char **output) {
if (!tmp) {
perror("realloc failed");
return -1;
+ } else if (tmp != *output) {
+ *output = tmp;
}
- *output = tmp;
*output_bytes = new_size;
}
return 0;