some more memory management stuff
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@5 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
e70ddd377d
commit
f85524cf0f
|
@ -97,7 +97,7 @@ char ttyrec_filename[100];
|
||||||
/* makes a max number of users compiled in */
|
/* makes a max number of users compiled in */
|
||||||
int f_num = 0;
|
int f_num = 0;
|
||||||
struct dg_user** users = NULL;
|
struct dg_user** users = NULL;
|
||||||
struct dg_user* me;
|
struct dg_user* me = NULL;
|
||||||
|
|
||||||
/* ************************************************************* */
|
/* ************************************************************* */
|
||||||
/* for ttyrec */
|
/* for ttyrec */
|
||||||
|
@ -534,8 +534,12 @@ freefile ()
|
||||||
free (users[i]->username);
|
free (users[i]->username);
|
||||||
free (users[i]->email);
|
free (users[i]->email);
|
||||||
free (users[i]->env);
|
free (users[i]->env);
|
||||||
|
free (users[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(users);
|
||||||
|
users = NULL;
|
||||||
|
me = NULL;
|
||||||
f_num = 0;
|
f_num = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,14 +558,6 @@ initncurses ()
|
||||||
|
|
||||||
/* ************************************************************* */
|
/* ************************************************************* */
|
||||||
|
|
||||||
void
|
|
||||||
initvars ()
|
|
||||||
{
|
|
||||||
me = malloc(sizeof(struct dg_user));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ************************************************************* */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
login ()
|
login ()
|
||||||
{
|
{
|
||||||
|
@ -633,6 +629,11 @@ newuser ()
|
||||||
|
|
||||||
loggedin = 0;
|
loggedin = 0;
|
||||||
|
|
||||||
|
if (me)
|
||||||
|
free(me);
|
||||||
|
|
||||||
|
me = malloc(sizeof(struct dg_user));
|
||||||
|
|
||||||
while (error)
|
while (error)
|
||||||
{
|
{
|
||||||
clear ();
|
clear ();
|
||||||
|
@ -1019,8 +1020,6 @@ main (void)
|
||||||
setgid (newgid);
|
setgid (newgid);
|
||||||
setuid (newuid);
|
setuid (newuid);
|
||||||
|
|
||||||
initvars ();
|
|
||||||
|
|
||||||
/* simple login routine, uses ncurses */
|
/* simple login routine, uses ncurses */
|
||||||
if (readfile (0))
|
if (readfile (0))
|
||||||
exit (110);
|
exit (110);
|
||||||
|
|
Loading…
Reference in New Issue