Commit 90ee891a authored by deuce's avatar deuce
Browse files

Fix insane memory overallocation.

parent 0bf76092
......@@ -109,9 +109,9 @@ void node_toggles(scfg_t *cfg,int nodenum) {
node_t node;
int save=0;
if((opt=(char **)alloca(sizeof(char *)*(MAX_OPTS+1)))==NULL)
allocfail(sizeof(char *)*(MAX_OPTS+1));
for(i=0;i<(MAX_OPTS+1);i++)
if((opt=(char **)alloca(sizeof(char *)*(4+1)))==NULL)
allocfail(sizeof(char *)*(4+1));
for(i=0;i<(4+1);i++)
if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
allocfail(MAX_OPLN);
......@@ -447,9 +447,9 @@ int view_logs(scfg_t *cfg)
localtime_r(&now,&tm);
now -= 60*60*24;
localtime_r(&now,&tm_yest);
if((opt=(char **)alloca(sizeof(char *)*(MAX_OPTS+1)))==NULL)
allocfail(sizeof(char *)*(MAX_OPTS+1));
for(i=0;i<(MAX_OPTS+1);i++)
if((opt=(char **)alloca(sizeof(char *)*(9+1)))==NULL)
allocfail(sizeof(char *)*(9+1));
for(i=0;i<(9+1);i++)
if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
allocfail(MAX_OPLN);
......@@ -550,9 +550,9 @@ int qwk_callouts(scfg_t *cfg)
return(1);
}
if((opt=(char **)alloca(sizeof(char *)*(MAX_OPTS+1)))==NULL)
allocfail(sizeof(char *)*(MAX_OPTS+1));
for(i=0;i<(MAX_OPTS+1);i++)
if((opt=(char **)alloca(sizeof(char *)*(cfg->total_qhubs+1)))==NULL)
allocfail(sizeof(char *)*(cfg->total_qhubs+1));
for(i=0;i<(cfg->total_qhubs+1);i++)
if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
allocfail(MAX_OPLN);
......@@ -589,9 +589,9 @@ int run_events(scfg_t *cfg)
int i,j;
char str[1024];
if((opt=(char **)alloca(sizeof(char *)*(MAX_OPTS+1)))==NULL)
allocfail(sizeof(char *)*(MAX_OPTS+1));
for(i=0;i<(MAX_OPTS+1);i++)
if((opt=(char **)alloca(sizeof(char *)*(cfg->total_events+1)))==NULL)
allocfail(sizeof(char *)*(cfg->total_events+1));
for(i=0;i<(cfg->total_events+1);i++)
if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
allocfail(MAX_OPLN);
......@@ -631,9 +631,9 @@ int recycle_servers(scfg_t *cfg)
char **opt;
int i=0;
if((opt=(char **)alloca(sizeof(char *)*(MAX_OPTS+1)))==NULL)
allocfail(sizeof(char *)*(MAX_OPTS+1));
for(i=0;i<(MAX_OPTS+1);i++)
if((opt=(char **)alloca(sizeof(char *)*(5+1)))==NULL)
allocfail(sizeof(char *)*(5+1));
for(i=0;i<(5+1);i++)
if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
allocfail(MAX_OPLN);
......@@ -703,9 +703,9 @@ int edit_cfg(scfg_t *cfg)
char cmd[1024];
char editcmd[1024];
if((opt=(char **)alloca(sizeof(char *)*(MAX_OPTS+1)))==NULL)
allocfail(sizeof(char *)*(MAX_OPTS+1));
for(i=0;i<(MAX_OPTS+1);i++)
if((opt=(char **)alloca(sizeof(char *)*(17+1)))==NULL)
allocfail(sizeof(char *)*(17+1));
for(i=0;i<(17+1);i++)
if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
allocfail(MAX_OPLN);
......@@ -751,9 +751,9 @@ int edit_can(scfg_t *cfg)
char cmd[1024];
char editcmd[1024];
if((opt=(char **)alloca(sizeof(char *)*(MAX_OPTS+1)))==NULL)
allocfail(sizeof(char *)*(MAX_OPTS+1));
for(i=0;i<(MAX_OPTS+1);i++)
if((opt=(char **)alloca(sizeof(char *)*(9+1)))==NULL)
allocfail(sizeof(char *)*(9+1));
for(i=0;i<(9+1);i++)
if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
allocfail(MAX_OPLN);
......@@ -950,15 +950,15 @@ int main(int argc, char** argv) {
exit(1);
}
if((opt=(char **)alloca(sizeof(char *)*(MAX_OPTS+1)))==NULL)
allocfail(sizeof(char *)*(MAX_OPTS+1));
for(i=0;i<(MAX_OPTS+1);i++)
if((opt=(char **)alloca(sizeof(char *)*(10+1)))==NULL)
allocfail(sizeof(char *)*(10+1));
for(i=0;i<(10+1);i++)
if((opt[i]=(char *)alloca(MAX_OPLN))==NULL)
allocfail(MAX_OPLN);
if((mopt=(char **)alloca(sizeof(char *)*MAX_OPTS))==NULL)
allocfail(sizeof(char *)*MAX_OPTS);
for(i=0;i<MAX_OPTS;i++)
if((mopt=(char **)alloca(sizeof(char *)*cfg.sys_nodes+2))==NULL)
allocfail(sizeof(char *)*cfg.sys_nodes+2);
for(i=0;i<cfg.sys_nodes+2;i++)
if((mopt[i]=(char *)alloca(MAX_OPLN))==NULL)
allocfail(MAX_OPLN);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment