Browse Source

don't try to qsort() NULL array

while this actually works due to the array size being zero, it's
undefined behavior which makes gcc eliminate a subsequent null check in
the calling function.
master
Oswald Buddenhagen 4 months ago
parent
commit
ceb0fa9803
  1. 1
      src/main_sync.c

1
src/main_sync.c

@ -186,6 +186,7 @@ filter_boxes( string_list_t *boxes, const char *prefix, string_list_t *patterns
boxarr[num] = NULL; boxarr[num] = NULL;
} }
} }
if (boxarr)
qsort( boxarr, num, sizeof(*boxarr), cmp_box_names ); qsort( boxarr, num, sizeof(*boxarr), cmp_box_names );
return boxarr; return boxarr;
} }

Loading…
Cancel
Save