summaryrefslogtreecommitdiff
path: root/tree-diff.c
diff options
context:
space:
mode:
Diffstat (limited to 'tree-diff.c')
-rw-r--r--tree-diff.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/tree-diff.c b/tree-diff.c
index e164e53..1e1b393 100644
--- a/tree-diff.c
+++ b/tree-diff.c
@@ -140,8 +140,7 @@ static struct combine_diff_path *path_appendnew(struct combine_diff_path *last,
/* if last->next is !NULL - it is a pre-allocated memory, we can reuse */
p = last->next;
if (p && (alloclen > (intptr_t)p->next)) {
- free(p);
- p = NULL;
+ FREE_AND_NULL(p);
}
if (!p) {
@@ -559,8 +558,7 @@ struct combine_diff_path *diff_tree_paths(
* (see path_appendnew() for details about why)
*/
if (p->next) {
- free(p->next);
- p->next = NULL;
+ FREE_AND_NULL(p->next);
}
return p;