firmware-utils/dgfirmare: fix possible resource leak
Add missing calls to `fclose` in functions `write_img`, `write_rootfs` and `write_kernel`. The not-closed files could lead to resource leaks. Signed-off-by: Andrea Dalla Costa <andrea@dallacosta.me>
This commit is contained in:
committed by
Jo-Philipp Wich
parent
22b07ff73e
commit
402b362db4
@@ -86,6 +86,8 @@ void write_img(unsigned char* img, const char *fname)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -104,6 +106,8 @@ void write_rootfs(unsigned char* img, const char *fname)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -122,6 +126,8 @@ void write_kernel(unsigned char* img, const char *fname)
|
|||||||
fclose(fp);
|
fclose(fp);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user