mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 03:08:05 +02:00
freedreno/tools: Fix compiler warnings about using sz in the error paths.
If we don't check for a NULL str, then sz might be undefined (as was happening in the match_compatible path, and returning 0 makes us not match as we should). Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7224>
This commit is contained in:
parent
91c5bbc128
commit
a512e9eecd
2 changed files with 6 additions and 2 deletions
|
|
@ -781,8 +781,10 @@ static char * readfile(const char *path, int *sz)
|
|||
int fd, ret, n = 0;
|
||||
|
||||
fd = open(path, O_RDONLY);
|
||||
if (fd < 0)
|
||||
if (fd < 0) {
|
||||
*sz = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
buf = realloc(buf, n + CHUNKSIZE);
|
||||
|
|
|
|||
|
|
@ -115,8 +115,10 @@ readfile(const char *path, int *sz)
|
|||
int fd, ret, n = 0;
|
||||
|
||||
fd = open(path, O_RDONLY);
|
||||
if (fd < 0)
|
||||
if (fd < 0) {
|
||||
*sz = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
buf = realloc(buf, n + CHUNKSIZE);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue