roaring: Remove extra careful code
authorBenjamin Otte <otte@redhat.com>
Tue, 26 Apr 2022 17:38:36 +0000 (19:38 +0200)
committerBenjamin Otte <otte@redhat.com>
Tue, 26 Apr 2022 17:38:36 +0000 (19:38 +0200)
because gcc knows it's too careful

gtk/roaring/roaring.c

index 84a89e3fea8c742140c2c0f11d1de90486fd3861..17eec65ca8563c24d48aaca3b5e797e55420e0e2 100644 (file)
@@ -2979,7 +2979,6 @@ int array_container_shrink_to_fit(array_container_t *src) {
       uint16_t *oldarray = src->array;
       src->array =
         (uint16_t *)realloc(oldarray, src->capacity * sizeof(uint16_t));
-      if (src->array == NULL) free(oldarray);  // should never happen?
     }
     return savings;
 }
@@ -3016,7 +3015,6 @@ void array_container_grow(array_container_t *container, int32_t min,
     if (preserve) {
         container->array =
             (uint16_t *)realloc(array, new_capacity * sizeof(uint16_t));
-        if (container->array == NULL) free(array);
     } else {
         // Jon Strabala reports that some tools complain otherwise
         if (array != NULL) {
@@ -6691,7 +6689,6 @@ int run_container_shrink_to_fit(run_container_t *src) {
     src->capacity = src->n_runs;
     rle16_t *oldruns = src->runs;
     src->runs = (rle16_t *)realloc(oldruns, src->capacity * sizeof(rle16_t));
-    if (src->runs == NULL) free(oldruns);  // should never happen?
     return savings;
 }
 /* Create a new run container. Return NULL in case of failure. */
@@ -6731,7 +6728,6 @@ void run_container_grow(run_container_t *run, int32_t min, bool copy) {
         rle16_t *oldruns = run->runs;
         run->runs =
             (rle16_t *)realloc(oldruns, run->capacity * sizeof(rle16_t));
-        if (run->runs == NULL) free(oldruns);
     } else {
         // Jon Strabala reports that some tools complain otherwise
         if (run->runs != NULL) {