[Mesa-dev] [PATCH 3/9] glsl: Fix null access on file read error
Juha-Pekka Heikkila
juhapekka.heikkila at gmail.com
Fri Feb 7 04:43:59 PST 2014
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.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);
--
1.8.1.2
More information about the mesa-dev
mailing list