Merge branch 'jk/xmalloc'
authorJunio C Hamano <gitster@pobox.com>
Thu, 25 Apr 2019 07:41:23 +0000 (16:41 +0900)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Apr 2019 07:41:23 +0000 (16:41 +0900)
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

1  2 
progress.c

diff --cc 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;