summaryrefslogtreecommitdiff
path: root/src/diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/diff.c')
-rw-r--r--src/diff.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/diff.c b/src/diff.c
index 75e9ae9a3..07eae03e7 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1527,6 +1527,7 @@ int git_diff_format_email(
char *summary = NULL, *loc = NULL;
bool ignore_marker;
unsigned int format_flags = 0;
+ size_t allocsize;
int error;
assert(out && diff && opts);
@@ -1558,8 +1559,8 @@ int git_diff_format_email(
goto on_error;
}
- GITERR_CHECK_ALLOC_ADD(offset, 1);
- summary = git__calloc(offset + 1, sizeof(char));
+ GITERR_CHECK_ALLOC_ADD(&allocsize, offset, 1);
+ summary = git__calloc(allocsize, sizeof(char));
GITERR_CHECK_ALLOC(summary);
strncpy(summary, opts->summary, offset);