Mesa (master): mesa: Close fp on error path.

Matt Turner mattst88 at kemper.freedesktop.org
Thu Jun 30 18:11:26 UTC 2016


Module: Mesa
Branch: master
Commit: 058c70bae1a70d63671b2f37a10950b21e615802
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=058c70bae1a70d63671b2f37a10950b21e615802

Author: Matt Turner <mattst88 at gmail.com>
Date:   Mon Jun 27 16:31:09 2016 -0700

mesa: Close fp on error path.

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/main/dlist.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 3845d2e..9d9e319 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -10086,15 +10086,12 @@ print_list(struct gl_context *ctx, GLuint list, const char *fname)
 
    if (!islist(ctx, list)) {
       fprintf(f, "%u is not a display list ID\n", list);
-      return;
+      goto out;
    }
 
    dlist = _mesa_lookup_list(ctx, list);
    if (!dlist) {
-      if (fname) {
-         fclose(f);
-      }
-      return;
+      goto out;
    }
 
    n = dlist->Head;
@@ -10366,7 +10363,7 @@ print_list(struct gl_context *ctx, GLuint list, const char *fname)
                printf
                   ("ERROR IN DISPLAY LIST: opcode = %d, address = %p\n",
                    opcode, (void *) n);
-               return;
+               goto out;
             }
             else {
                fprintf(f, "command %d, %u operands\n", opcode,
@@ -10380,6 +10377,7 @@ print_list(struct gl_context *ctx, GLuint list, const char *fname)
       }
    }
 
+ out:
    fflush(f);
    if (fname)
       fclose(f);




More information about the mesa-commit mailing list