summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;