diff options
author | ebola_rulez <ebola_rulez@users.sourceforge.net> | 2011-01-20 00:30:48 +0800 |
---|---|---|
committer | Christian Beier <dontmind@freeshell.org> | 2011-01-20 13:29:38 +0100 |
commit | 5e1488beb3903b2d3fa2fd2457f8bff781033d9a (patch) | |
tree | f4a4ac7f534da594daf5c9957670202d8de956d0 | |
parent | 658bef5fdeeb39557d570536f1709e5c520a1d72 (diff) | |
download | libvncserver-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.c | 6 |
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; |