mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-17 16:47:50 +00:00
plugins/amdgpu: Close dma-buf image file if the read fails
Consolidate to one fclose() call with the extra bonus the inconsequential file descriptor leak is eliminated. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Reviewed-By: David Francis <David.Francis@amd.com>
This commit is contained in:
parent
46e800c465
commit
21c714f494
1 changed files with 1 additions and 2 deletions
|
|
@ -120,6 +120,7 @@ int amdgpu_plugin_dmabuf_restore(int id)
|
|||
}
|
||||
|
||||
ret = read_fp(img_fp, buf, img_size);
|
||||
fclose(img_fp);
|
||||
if (ret) {
|
||||
pr_perror("Unable to read from %s", path);
|
||||
xfree(buf);
|
||||
|
|
@ -130,10 +131,8 @@ int amdgpu_plugin_dmabuf_restore(int id)
|
|||
if (rd == NULL) {
|
||||
pr_perror("Unable to parse the dmabuf message %d", id);
|
||||
xfree(buf);
|
||||
fclose(img_fp);
|
||||
return -1;
|
||||
}
|
||||
fclose(img_fp);
|
||||
|
||||
/* Match GEM handle with shared_dmabuf list */
|
||||
fd_id = amdgpu_id_for_handle(rd->gem_handle);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue