Module: Mesa
Branch: main
Commit: f572961d6937c0adceab39dd883cb53cfa965dc2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f572961d6937c0adceab39dd883cb53cfa965dc2

Author: Konstantin Kharlamov <[email protected]>
Date:   Wed Aug 10 01:18:16 2022 +0300

loader/dri3: simplify check for reply

if reply == NULL, the call `free(reply)` is a no-op, so we can have a
single check instead of two.

Signed-off-by: Konstantin Kharlamov <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17974>

---

 src/loader/loader_dri3_helper.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index 89f0d8eaba1..6cae8eb7f1f 100644
--- a/src/loader/loader_dri3_helper.c
+++ b/src/loader/loader_dri3_helper.c
@@ -1239,10 +1239,8 @@ loader_dri3_open(xcb_connection_t *conn,
                           provider);
 
    reply = xcb_dri3_open_reply(conn, cookie, NULL);
-   if (!reply)
-      return -1;
 
-   if (reply->nfd != 1) {
+   if (!reply || reply->nfd != 1) {
       free(reply);
       return -1;
    }

Reply via email to