priv->username = gnutls_strdup(cred->username);
if (priv->username == NULL) {
gnutls_assert();
+ ret = GNUTLS_E_MEMORY_ERROR;
goto cleanup;
}
priv->password = gnutls_strdup(cred->password);
if (priv->password == NULL) {
+ gnutls_free(priv->username);
gnutls_assert();
+ ret = GNUTLS_E_MEMORY_ERROR;
goto cleanup;
}
if (cred->get_function(session, &username, &password) < 0 ||
username == NULL || password == NULL) {
gnutls_assert();
- return GNUTLS_E_ILLEGAL_SRP_USERNAME;
+ ret = GNUTLS_E_ILLEGAL_SRP_USERNAME;
+ goto cleanup;
}
len = MIN(strlen(username), 255);