mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-10-04 01:00:09 +00:00
Fix resource leaks in bin2o.c
Fix resource leaks in bin2o.c
This commit is contained in:
@@ -362,17 +362,20 @@ int main(int argc, char *argv[])
|
|||||||
buffer = malloc(size);
|
buffer = malloc(size);
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
printf("Failed to allocate memory.\n");
|
printf("Failed to allocate memory.\n");
|
||||||
|
fclose(dest);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fread(buffer, 1, size, source) != size) {
|
if (fread(buffer, 1, size, source) != size) {
|
||||||
printf("Failed to read file.\n");
|
printf("Failed to read file.\n");
|
||||||
|
fclose(dest);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
fclose(source);
|
fclose(source);
|
||||||
|
|
||||||
if (!(dest = fopen(f_dest, "wb+"))) {
|
if (!(dest = fopen(f_dest, "wb+"))) {
|
||||||
printf("Failed to open/create %s.\n", f_dest);
|
printf("Failed to open/create %s.\n", f_dest);
|
||||||
|
fclose(dest);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user