amdgpu: don't leak fd on an error path in open_img_file

Signed-off-by: Andrei Vagin <avagin@gmail.com>
This commit is contained in:
Andrei Vagin 2023-09-28 21:47:50 -07:00
parent a68975c06d
commit 940a05c0ba

View file

@ -165,6 +165,7 @@ FILE *open_img_file(char *path, bool write, size_t *size)
fp = fdopen(fd, write ? "w" : "r");
if (!fp) {
pr_perror("%s: Failed get pointer for %s", path, write ? "write" : "read");
close(fd);
return NULL;
}