summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorebola_rulez <ebola_rulez@users.sourceforge.net>2011-01-20 00:30:48 +0800
committerChristian Beier <dontmind@freeshell.org>2011-01-20 13:29:38 +0100
commit5e1488beb3903b2d3fa2fd2457f8bff781033d9a (patch)
treef4a4ac7f534da594daf5c9957670202d8de956d0
parent658bef5fdeeb39557d570536f1709e5c520a1d72 (diff)
downloadlibvncserver-5e1488beb3903b2d3fa2fd2457f8bff781033d9a.zip
libvncserver-5e1488beb3903b2d3fa2fd2457f8bff781033d9a.tar.gz
Fix two errors found by cppcheck
Signed-off-by: Vic Lee <llyzs@163.com> Signed-off-by: Christian Beier <dontmind@freeshell.org>
-rw-r--r--libvncserver/vncauth.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libvncserver/vncauth.c b/libvncserver/vncauth.c
index 0b73531..83c56e6 100644
--- a/libvncserver/vncauth.c
+++ b/libvncserver/vncauth.c
@@ -120,12 +120,16 @@ rfbDecryptPasswdFromFile(char *fname)
int i, ch;
unsigned char *passwd = (unsigned char *)malloc(9);
- if ((fp = fopen(fname,"r")) == NULL) return NULL;
+ if ((fp = fopen(fname,"r")) == NULL) {
+ free(passwd);
+ return NULL;
+ }
for (i = 0; i < 8; i++) {
ch = getc(fp);
if (ch == EOF) {
fclose(fp);
+ free(passwd);
return NULL;
}
passwd[i] = ch;
OpenPOWER on IntegriCloud