summaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2005-12-24 04:12:43 -0800
committerJunio C Hamano <junkio@cox.net>2005-12-26 08:59:21 -0800
commit7d6fb370bc98e5d4723103dda0829b00c79da213 (patch)
treea2b3b32b5e0e2e43fbff7cd2bf6c6e60e78cbecd /diffcore-rename.c
parentac44f3e7c05390531004d567481004c96d1b262c (diff)
downloadgit-7d6fb370bc98e5d4723103dda0829b00c79da213.tar.gz
short circuit out of a few places where we would allocate zero bytes
dietlibc versions of malloc, calloc and realloc all return NULL if they're told to allocate 0 bytes, causes the x* wrappers to die(). There are several more places where these calls could end up asking for 0 bytes, too... Maybe simply not die()-ing in the x* wrappers if 0/NULL is returned when the requested size is zero is a safer and easier way to go. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index dba965c0b4..39d9126cb9 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -282,7 +282,7 @@ void diffcore_rename(struct diff_options *options)
else if (detect_rename == DIFF_DETECT_COPY)
register_rename_src(p->one, 1);
}
- if (rename_dst_nr == 0 ||
+ if (rename_dst_nr == 0 || rename_src_nr == 0 ||
(0 < rename_limit && rename_limit < rename_dst_nr))
goto cleanup; /* nothing to do */