mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-23 09:04:15 +00:00
librfb: don't leak password on error
This commit is contained in:
parent
f54458a7ba
commit
ed42bca0dd
1 changed files with 4 additions and 1 deletions
|
@ -96,15 +96,18 @@ vncDecryptPasswdFromFile (char *fname)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int32_t i, ch;
|
int32_t i, ch;
|
||||||
unsigned char *passwd = (unsigned char *) malloc (9);
|
unsigned char *passwd;
|
||||||
|
|
||||||
if ((fp = fopen (fname, "r")) == NULL)
|
if ((fp = fopen (fname, "r")) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
passwd = (unsigned char *) malloc (9);
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
ch = getc (fp);
|
ch = getc (fp);
|
||||||
if (ch == EOF) {
|
if (ch == EOF) {
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
free (passwd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
passwd[i] = ch;
|
passwd[i] = ch;
|
||||||
|
|
Loading…
Reference in a new issue