* dcrt0.cc (insert_file): Fix resource leaks (CIDs 59987, 59988).

This commit is contained in:
Corinna Vinschen 2014-06-23 10:18:26 +00:00
parent efaf85c5e6
commit a1fd4b1a03
2 changed files with 7 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2014-06-23 Corinna Vinschen <corinna@vinschen.de>
* dcrt0.cc (insert_file): Fix resource leaks (CIDs 59987, 59988).
2014-06-23 Corinna Vinschen <corinna@vinschen.de>
* ldap.cc (CYG_LDAP_TIMEOUT): Set to 5 secs.

View File

@ -115,6 +115,7 @@ insert_file (char *name, char *&cmd)
size = GetFileSize (f, NULL);
if (size == 0xFFFFFFFF)
{
CloseHandle (f);
debug_printf ("couldn't get file size for '%s', %E", name);
return false;
}
@ -123,6 +124,7 @@ insert_file (char *name, char *&cmd)
char *tmp = (char *) malloc (new_size);
if (!tmp)
{
CloseHandle (f);
debug_printf ("malloc failed, %E");
return false;
}
@ -134,6 +136,7 @@ insert_file (char *name, char *&cmd)
CloseHandle (f);
if (!rf_result || (rf_read != size))
{
free (tmp);
debug_printf ("ReadFile failed, %E");
return false;
}