From 808892742b680a3a75c6e5a31bf1c62c27cd30c3 Mon Sep 17 00:00:00 2001 From: Ryan Pavlik Date: Mon, 2 Dec 2019 17:20:44 -0600 Subject: [PATCH] st/p: Fix allocation size error with realloc macro --- src/xrt/state_trackers/prober/p_prober.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/xrt/state_trackers/prober/p_prober.c b/src/xrt/state_trackers/prober/p_prober.c index 95315379c..a5f7f0700 100644 --- a/src/xrt/state_trackers/prober/p_prober.c +++ b/src/xrt/state_trackers/prober/p_prober.c @@ -280,9 +280,8 @@ add_device(struct prober *p, struct prober_device **out_dev) static void add_usb_entry(struct prober *p, struct xrt_prober_entry *entry) { - size_t new_size = - (p->num_entries + 1) * sizeof(struct xrt_prober_entry_usb *); - p->entries = realloc(p->entries, new_size); + U_ARRAY_REALLOC_OR_FREE(p->entries, struct xrt_prober_entry *, + (p->num_entries + 1)); p->entries[p->num_entries++] = entry; }