Fix invalid memory access in soundio_sort_channel_layouts()

This commit is contained in:
Cameron Gutman 2018-10-03 19:01:59 -07:00 committed by Andrew Kelley
parent 7c53dabc6e
commit 5ae35e2722

View file

@ -733,8 +733,8 @@ const struct SoundIoChannelLayout *soundio_best_matching_channel_layout(
} }
static int compare_layouts(const void *a, const void *b) { static int compare_layouts(const void *a, const void *b) {
const struct SoundIoChannelLayout *layout_a = *((struct SoundIoChannelLayout **)a); const struct SoundIoChannelLayout *layout_a = (const struct SoundIoChannelLayout *)a;
const struct SoundIoChannelLayout *layout_b = *((struct SoundIoChannelLayout **)b); const struct SoundIoChannelLayout *layout_b = (const struct SoundIoChannelLayout *)b;
if (layout_a->channel_count > layout_b->channel_count) if (layout_a->channel_count > layout_b->channel_count)
return -1; return -1;
else if (layout_a->channel_count < layout_b->channel_count) else if (layout_a->channel_count < layout_b->channel_count)