forked from lda/telodendria
Fix use after free.
This commit is contained in:
parent
599fa1a740
commit
a4364dbb68
2 changed files with 11 additions and 2 deletions
|
@ -52,6 +52,7 @@ ROUTE_IMPL(RouteRegister, args)
|
|||
char *deviceId = NULL;
|
||||
|
||||
Db *db = args->matrixArgs->db;
|
||||
LogConfig *lc = args->matrixArgs->lc;
|
||||
|
||||
User *user = NULL;
|
||||
|
||||
|
@ -207,8 +208,10 @@ ROUTE_IMPL(RouteRegister, args)
|
|||
{
|
||||
/* TODO: Log in user here and attach auth info to response */
|
||||
}
|
||||
UserUnlock(user);
|
||||
|
||||
Log(lc, LOG_INFO, "Registered user '%s'", UserGetName(user));
|
||||
|
||||
UserUnlock(user);
|
||||
finish:
|
||||
Free(username);
|
||||
Free(password);
|
||||
|
|
|
@ -121,13 +121,19 @@ UserLock(Db * db, char *name)
|
|||
int
|
||||
UserUnlock(User * user)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!user)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Free(user->name);
|
||||
|
||||
ret = DbUnlock(user->db, user->ref);
|
||||
Free(user);
|
||||
return DbUnlock(user->db, user->ref);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
User *
|
||||
|
|
Loading…
Reference in a new issue