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
index 6cde5959fac75ab2640f11346dd124c962d98067,699ac33c4f0609351a403e6779952c6c6ab7cb74..0318bdd41b2f40b6f3cedeb8ca72ead677038d6e
@@@ -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;