HTTP Auth: Squash error path leaks.

This commit is contained in:
Michael Drake 2018-08-15 11:11:54 +01:00
parent 097f8dcde5
commit 9c29935f3c

View File

@ -146,6 +146,8 @@ static nserror netsurf__unpack_userpass(
username = malloc(1);
password = malloc(1);
if (username == NULL || password == NULL) {
free(username);
free(password);
return NSERROR_NOMEM;
}
username[0] = '\0';
@ -167,6 +169,8 @@ static nserror netsurf__unpack_userpass(
username = malloc(len + 1);
password = malloc(len2 + 1);
if (username == NULL || password == NULL) {
free(username);
free(password);
return NSERROR_NOMEM;
}
memcpy(username, userpass, len);