diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-03-24 19:10:04 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-03-24 19:10:04 -0400 |
commit | 8740cb749d754683b27788d4c1a69f9522b34c82 (patch) | |
tree | 13b1952f889f58ad81113371975a060bab0cf954 | |
parent | 1e46672463d56acc6d64bcc0ec393b7f0ee50889 (diff) | |
download | stasis-8740cb749d754683b27788d4c1a69f9522b34c82.tar.gz |
Fix realloc error handling
-rw-r--r-- | src/template.c | 3 |
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; |