mirror of
https://github.com/clearlinux/swupd-client.git
synced 2026-10-03 15:29:29 +00:00
clean: fix returning garbage in failure cases
The variable contents was not being properly set when early failures happen in read_mom_contents. Found with clang static analyzer.
This commit is contained in:
committed by
Matthew Johnson
parent
7badf98216
commit
a49e188288
+2
-1
@@ -226,6 +226,7 @@ static char *read_mom_contents(int version)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *contents = NULL;
|
||||
int fd = fileno(f);
|
||||
if (fd == -1) {
|
||||
goto end;
|
||||
@@ -238,7 +239,7 @@ static char *read_mom_contents(int version)
|
||||
goto end;
|
||||
}
|
||||
|
||||
char *contents = malloc(stat.st_size + 1);
|
||||
contents = malloc(stat.st_size + 1);
|
||||
if (!contents) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user