aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuha-Pekka Heikkila <[email protected]>2014-02-07 14:43:59 +0200
committerBrian Paul <[email protected]>2014-02-07 08:14:04 -0700
commit88cad8356eadde7b6bc25cc5a0c1762352e5b3f7 (patch)
tree726029ada1e6674305340ddd4ecc2df1d50074ef
parent2ae1437a8ecf81676012c7a3507a6ed58e7338b2 (diff)
glsl: Fix null access on file read error
Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Brian Paul <[email protected]>
-rw-r--r--src/glsl/main.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index 5ea57d53a88..3a0f812f237 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);