From: Junio C Hamano Date: Thu, 25 Apr 2019 07:41:23 +0000 (+0900) Subject: Merge branch 'jk/xmalloc' X-Git-Tag: v2.22.0-rc0~43 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=449f2db75dd990d5b1157c7d4da49f046eab27c6;p=git Merge branch 'jk/xmalloc' The code is updated to check the result of memory allocation before it is used in more places, by using xmalloc and/or xcalloc calls. * jk/xmalloc: progress: use xmalloc/xcalloc xdiff: use xmalloc/xrealloc xdiff: use git-compat-util test-prio-queue: use xmalloc --- 449f2db75dd990d5b1157c7d4da49f046eab27c6 diff --cc progress.c index 6cde5959fa,699ac33c4f..0318bdd41b --- a/progress.c +++ b/progress.c @@@ -223,15 -192,9 +221,9 @@@ void display_progress(struct progress * } static struct progress *start_progress_delay(const char *title, uint64_t total, - unsigned delay) + unsigned delay, unsigned sparse) { - struct progress *progress = malloc(sizeof(*progress)); - if (!progress) { - /* unlikely, but here's a good fallback */ - fprintf(stderr, "%s...\n", title); - fflush(stderr); - return NULL; - } + struct progress *progress = xmalloc(sizeof(*progress)); progress->title = title; progress->total = total; progress->last_value = -1;