Commit 5e1488be authored by ebola_rulez's avatar ebola_rulez Committed by Christian Beier

Fix two errors found by cppcheck

Signed-off-by: 's avatarVic Lee <llyzs@163.com>
Signed-off-by: 's avatarChristian Beier <dontmind@freeshell.org>
parent 658bef5f
......@@ -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;
......
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