Prevent potential file descriptor resource leak

This commit is contained in:
Ian Barwick
2019-03-28 12:29:10 +09:00
parent f23a93e12d
commit 73554c6e16

View File

@@ -3108,11 +3108,12 @@ copy_file(const char *src_file, const char *dest_file)
int a = 0;
ptr_old = fopen(src_file, "r");
ptr_new = fopen(dest_file, "w");
if (ptr_old == NULL)
return false;
ptr_new = fopen(dest_file, "w");
if (ptr_new == NULL)
{
fclose(ptr_old);