Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-07-19 21:23:45 +0400
committerRussell Belfer <rb@github.com>2012-07-19 21:23:45 +0400
commit71d273583755c0a2b7f5d608f017f4586add51e4 (patch)
tree9a70607c88d126591a5fc7241987e5d410e3bf0f /src/pool.h
parent5a8204f8a88c59c2cb07b93930834ef0a5aaf1fc (diff)
Fix bug with merging diffs with null options
A diff that is created with a NULL options parameter could result in a NULL prefix string, but diff merge was unconditionally strdup'ing it. I added a test to replicate the issue and then a new method that does the right thing with NULL values.
Diffstat (limited to 'src/pool.h')
-rw-r--r--src/pool.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pool.h b/src/pool.h
index 54a2861ed..05d339244 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -90,6 +90,13 @@ extern char *git_pool_strndup(git_pool *pool, const char *str, size_t n);
extern char *git_pool_strdup(git_pool *pool, const char *str);
/**
+ * Allocate space and duplicate a string into it, NULL is no error.
+ *
+ * This is allowed only for pools with item_size == sizeof(char)
+ */
+extern char *git_pool_strdup_safe(git_pool *pool, const char *str);
+
+/**
* Allocate space for the concatenation of two strings.
*
* This is allowed only for pools with item_size == sizeof(char)