summaryrefslogtreecommitdiff
path: root/src/buffer.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-06-23 15:41:58 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-06-24 23:49:10 +0200
commitcaab22c0d468e90b6a95072f3092d5dcf331b3ef (patch)
tree158e761b2c5fea6fc651e8960c84fbb9fe307094 /src/buffer.h
parentaacfd03dba68333da726bb63e2594f3ed4a16422 (diff)
downloadlibgit2-caab22c0d468e90b6a95072f3092d5dcf331b3ef.tar.gz
buffer: don't allow growing borrowed buffers
When we don't own a buffer (asize=0) we currently allow the usage of grow to copy the memory into a buffer we do own. This muddles the meaning of grow, and lets us be a bit cavalier with ownership semantics. Don't allow this any more. Usage of grow should be restricted to buffers which we know own their own memory. If unsure, we must not attempt to modify it.
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/buffer.h b/src/buffer.h
index 093ed9b60..e46ee5dd7 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -59,7 +59,7 @@ extern int git_buf_grow_by(git_buf *buffer, size_t additional_size);
* into the newly allocated buffer.
*/
extern int git_buf_try_grow(
- git_buf *buf, size_t target_size, bool mark_oom, bool preserve_external);
+ git_buf *buf, size_t target_size, bool mark_oom);
/**
* Sanitizes git_buf structures provided from user input. Users of the