HTTP Auth: Squash error path leaks.
This commit is contained in:
parent
097f8dcde5
commit
9c29935f3c
|
@ -146,6 +146,8 @@ static nserror netsurf__unpack_userpass(
|
||||||
username = malloc(1);
|
username = malloc(1);
|
||||||
password = malloc(1);
|
password = malloc(1);
|
||||||
if (username == NULL || password == NULL) {
|
if (username == NULL || password == NULL) {
|
||||||
|
free(username);
|
||||||
|
free(password);
|
||||||
return NSERROR_NOMEM;
|
return NSERROR_NOMEM;
|
||||||
}
|
}
|
||||||
username[0] = '\0';
|
username[0] = '\0';
|
||||||
|
@ -167,6 +169,8 @@ static nserror netsurf__unpack_userpass(
|
||||||
username = malloc(len + 1);
|
username = malloc(len + 1);
|
||||||
password = malloc(len2 + 1);
|
password = malloc(len2 + 1);
|
||||||
if (username == NULL || password == NULL) {
|
if (username == NULL || password == NULL) {
|
||||||
|
free(username);
|
||||||
|
free(password);
|
||||||
return NSERROR_NOMEM;
|
return NSERROR_NOMEM;
|
||||||
}
|
}
|
||||||
memcpy(username, userpass, len);
|
memcpy(username, userpass, len);
|
||||||
|
|
Loading…
Reference in New Issue