mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 07:18:17 +02:00
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:
parent
2ae1437a8e
commit
88cad8356e
1 changed files with 2 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue