aboutsummaryrefslogtreecommitdiff
path: root/daemon.c
diff options
context:
space:
mode:
authorJonas Fonseca <fonseca@diku.dk>2006-08-26 16:16:18 +0200
committerJunio C Hamano <junkio@cox.net>2006-08-26 17:54:06 -0700
commit83572c1a914d3f7a8dd66d954c11bbc665b7b923 (patch)
treebae4dc57d36b83c835253498dfdabd29d4dec66e /daemon.c
parent095c424d08d96a5f9ee3ca53ae952e92c5cff99b (diff)
downloadgit-83572c1a914d3f7a8dd66d954c11bbc665b7b923.tar.gz
git-83572c1a914d3f7a8dd66d954c11bbc665b7b923.tar.xz
Use xrealloc instead of realloc
Change places that use realloc, without a proper error path, to instead use xrealloc. Drop an erroneous error path in the daemon code that used errno in the die message in favour of the simpler xrealloc. Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'daemon.c')
-rw-r--r--daemon.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/daemon.c b/daemon.c
index 012936f3b..5bf5c8262 100644
--- a/daemon.c
+++ b/daemon.c
@@ -526,7 +526,6 @@ static int socksetup(int port, int **socklist_p)
for (ai = ai0; ai; ai = ai->ai_next) {
int sockfd;
- int *newlist;
sockfd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (sockfd < 0)
@@ -560,11 +559,7 @@ static int socksetup(int port, int **socklist_p)
continue; /* not fatal */
}
- newlist = realloc(socklist, sizeof(int) * (socknum + 1));
- if (!newlist)
- die("memory allocation failed: %s", strerror(errno));
-
- socklist = newlist;
+ socklist = xrealloc(socklist, sizeof(int) * (socknum + 1));
socklist[socknum++] = sockfd;
if (maxfd < sockfd)