glsl: Fix null access on file read error

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Juha-Pekka Heikkila 2014-02-07 14:43:59 +02:00 committed by Brian Paul
parent 2ae1437a8e
commit 88cad8356e

View file

@ -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);