Commit 1fdbd273 authored by Robert Sprowson's avatar Robert Sprowson

Fix handle and memory leaks on error

Found by cppcheck static analysis.

Version 0.72. Tagged as 'OmniNFS-0_72'
parent 82f6f04c
/* (0.71)
/* (0.72)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.71
#define Module_MajorVersion_CMHG 0.72
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 29 Jan 2018
#define Module_Date_CMHG 25 Sep 2018
#define Module_MajorVersion "0.71"
#define Module_Version 71
#define Module_MajorVersion "0.72"
#define Module_Version 72
#define Module_MinorVersion ""
#define Module_Date "29 Jan 2018"
#define Module_Date "25 Sep 2018"
#define Module_ApplicationDate "29-Jan-18"
#define Module_ApplicationDate "25-Sep-18"
#define Module_ComponentName "OmniNFS"
#define Module_ComponentPath "castle/RiscOS/Sources/Networking/Omni/Protocols/OmniNFS"
#define Module_FullVersion "0.71"
#define Module_HelpVersion "0.71 (29 Jan 2018)"
#define Module_LibraryVersionInfo "0:71"
#define Module_FullVersion "0.72"
#define Module_HelpVersion "0.72 (25 Sep 2018)"
#define Module_LibraryVersionInfo "0:72"
......@@ -141,7 +141,10 @@ static _kernel_oserror *mountlist_update(void)
return intl_error(err_NO_MEMORY);
newmount->mount_name = malloc(strlen(name)+1);
if (newmount->mount_name == NULL)
{
free(newmount);
return intl_error(err_NO_MEMORY);
}
dprintf (("", "entry at 0x%p, string at 0x%p, ", newmount, newmount->mount_name));
newmount->magic = ONFS_MOUNT_MAGIC;
......@@ -335,7 +338,10 @@ static _kernel_oserror *Op_Mount(_kernel_swi_regs *r)
am->server_id = 0;
am->mount_name = malloc(strlen(new_name)+1);
if (am->mount_name == NULL)
{
free(am);
return intl_error(err_NO_MEMORY);
}
strcpy(am->mount_name, new_name);
......
......@@ -121,7 +121,10 @@ static struct hostent *_gethtent(void)
return (NULL);
again:
if ((p = fgets(hostbuf, BUFSIZ, hostf)) == NULL)
{
fclose(hostf);
return (NULL);
}
if (*p == '#')
goto again;
cp = strpbrk(p, "#\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment