xwin: no need to free auth data if AddResource fails
This is taken care of by SecurityDeleteAuthorization Reviewed-by: Rémi Cardona <remi@gentoo.org> Signed-off-by: Julien Cristau <jcristau@debian.org>
This commit is contained in:
parent
acf263df81
commit
d0c1a5bc61
|
@ -114,7 +114,6 @@ GenerateAuthorization(unsigned name_length,
|
||||||
Bool
|
Bool
|
||||||
winGenerateAuthorization(void)
|
winGenerateAuthorization(void)
|
||||||
{
|
{
|
||||||
Bool fFreeAuth = FALSE;
|
|
||||||
SecurityAuthorizationPtr pAuth = NULL;
|
SecurityAuthorizationPtr pAuth = NULL;
|
||||||
|
|
||||||
/* Call OS layer to generate authorization key */
|
/* Call OS layer to generate authorization key */
|
||||||
|
@ -123,7 +122,7 @@ winGenerateAuthorization(void)
|
||||||
0, NULL, &g_uiAuthDataLen, &g_pAuthData);
|
0, NULL, &g_uiAuthDataLen, &g_pAuthData);
|
||||||
if ((XID) ~0L == g_authId) {
|
if ((XID) ~0L == g_authId) {
|
||||||
ErrorF("winGenerateAuthorization - GenerateAuthorization failed\n");
|
ErrorF("winGenerateAuthorization - GenerateAuthorization failed\n");
|
||||||
goto auth_bailout;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
@ -139,7 +138,7 @@ winGenerateAuthorization(void)
|
||||||
if (!(pAuth)) {
|
if (!(pAuth)) {
|
||||||
ErrorF("winGenerateAuthorization - Failed allocating "
|
ErrorF("winGenerateAuthorization - Failed allocating "
|
||||||
"SecurityAuthorizationPtr.\n");
|
"SecurityAuthorizationPtr.\n");
|
||||||
goto auth_bailout;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in the auth fields */
|
/* Fill in the auth fields */
|
||||||
|
@ -155,21 +154,11 @@ winGenerateAuthorization(void)
|
||||||
/* Add the authorization to the server's auth list */
|
/* Add the authorization to the server's auth list */
|
||||||
if (!AddResource(g_authId, SecurityAuthorizationResType, pAuth)) {
|
if (!AddResource(g_authId, SecurityAuthorizationResType, pAuth)) {
|
||||||
ErrorF("winGenerateAuthorization - AddResource failed for auth.\n");
|
ErrorF("winGenerateAuthorization - AddResource failed for auth.\n");
|
||||||
fFreeAuth = TRUE;
|
return FALSE;
|
||||||
goto auth_bailout;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't free the auth data, since it is still used internally */
|
|
||||||
pAuth = NULL;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
auth_bailout:
|
|
||||||
if (fFreeAuth)
|
|
||||||
free(pAuth);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use our generated cookie for authentication */
|
/* Use our generated cookie for authentication */
|
||||||
|
|
Loading…
Reference in New Issue