[PATCH libdrm] xf86drm: Fix operator precedence
Thierry Reding
thierry.reding at gmail.com
Wed Feb 20 11:17:25 UTC 2019
From: Thierry Reding <treding at nvidia.com>
The array subscription operator ([]) has higher precedence than the
indirection operator (*), so we need to use parentheses to properly
instruct the compiler to dereference the pointer to an array first,
and then subscript into the array.
Fixes a crash observed on Tegra.
Signed-off-by: Thierry Reding <treding at nvidia.com>
---
xf86drm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/xf86drm.c b/xf86drm.c
index d006bb38f800..5de37083c9a3 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3606,14 +3606,14 @@ static int drmParseOFDeviceInfo(int maj, int min, char ***compatible)
free(value);
}
- *compatible[i] = tmp_name;
+ (*compatible)[i] = tmp_name;
}
return 0;
free:
while (i--)
- free(*compatible[i]);
+ free((*compatible)[i]);
free(*compatible);
return err;
--
2.20.1
More information about the dri-devel
mailing list