summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ac44f3e)
raw | patch | inline | side by side (parent: ac44f3e)
author | Eric Wong <normalperson@yhbt.net> | |
Sat, 24 Dec 2005 12:12:43 +0000 (04:12 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 26 Dec 2005 16:59:21 +0000 (08:59 -0800) |
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>
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>
commit.c | patch | blob | history | |
diffcore-rename.c | patch | blob | history |
diff --git a/commit.c b/commit.c
index e867b86e6a10d64354226b04f71df98d7448e072..edd4dedcdd13c2c3fd02714ef282b173f7cec7fe 100644 (file)
--- a/commit.c
+++ b/commit.c
next = next->next;
count++;
}
+
+ if (!count)
+ return;
/* allocate an array to help sort the list */
nodes = xcalloc(count, sizeof(*nodes));
/* link the list to the array */
diff --git a/diffcore-rename.c b/diffcore-rename.c
index dba965c0b4006251b1da04465d319c5fe9997ea4..39d9126cb9d397df06d41495a3402123fa4ba46b 100644 (file)
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
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 */