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.
wip/socket-debug
Oswald Buddenhagen 6 months ago
parent
commit
ceb0fa9803
  1. 3
      src/main_sync.c

3
src/main_sync.c

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

Loading…
Cancel
Save