Martin Ettl <ettl DOT martin AT gmx DOT de>: Fix various resource and memory leaks

See issue #4974 for more details.

svn path=/trunk/; revision=44364
This commit is contained in:
Gregor Schneider 2009-12-02 18:28:52 +00:00
parent 0c2fe0a124
commit 93d086d81a
4 changed files with 7 additions and 1 deletions

View file

@ -24,7 +24,7 @@ public:
TNetwork(SOCKET s = 0): socket(s), local_echo(1), line_mode(1),
net_type(TN_NETSOCKET), naws_func((Naws_func_t)NULL),
local_address((char *)NULL) {}
~TNetwork() {if(local_address) delete local_address;}
~TNetwork() {if(local_address) delete[] local_address;}
void SetSocket(SOCKET s);
SOCKET GetSocket() {return socket;}

View file

@ -180,6 +180,7 @@ printercache_load_blob(char *printer_name, uint8 ** data)
if (fstat(fd, &st))
{
xfree(path);
close(fd);
return 0;
}

View file

@ -1405,7 +1405,10 @@ load_licence(RDPCLIENT * This, unsigned char **data)
return -1;
if (fstat(fd, &st))
{
close(fd);
return -1;
}
*data = (uint8 *) xmalloc(st.st_size);
length = read(fd, *data, st.st_size);

View file

@ -1475,6 +1475,8 @@ int load_licence(uint8 ** data)
}
if (fstat(fd, &st))
{
close(fd);
xfree(path);
return -1;
}
*data = (uint8 *) xmalloc(st.st_size);