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

Author: Juha-Pekka Heikkila <juhapekka.heikk...@gmail.com>
Date:   Fri Feb  7 14:43:59 2014 +0200

glsl: Fix null access on file read error

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikk...@gmail.com>
Reviewed-by: Brian Paul <bri...@vmware.com>

---

 src/glsl/main.cpp |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index 5ea57d5..3a0f812 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -232,7 +232,7 @@ load_text_file(void *ctx, const char *file_name)
                        if (bytes < size - total_read) {
                                free(text);
                                text = NULL;
-                               break;
+                               goto error;
                        }
 
                        if (bytes == 0) {
@@ -243,6 +243,7 @@ load_text_file(void *ctx, const char *file_name)
                } while (total_read < size);
 
                text[total_read] = '\0';
+error:;
        }
 
        fclose(fp);

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to