A lot of fixes found with valgrind

This commit is contained in:
Michiel Broek
2003-12-04 22:07:33 +00:00
parent fab5a2edae
commit f0bbdba104
37 changed files with 2267 additions and 1427 deletions

View File

@@ -136,7 +136,10 @@ void die(int onsig)
t_end = time(NULL);
Syslog(' ', "MBCICO finished in %s", t_elapsed(t_start, t_end));
free_mem();
deinitnl();
if (envptr)
free(envptr);
ExitClient(onsig);
@@ -190,9 +193,9 @@ int main(int argc, char *argv[])
* Catch all signals we can, and ignore the rest.
*/
for (i = 0; i < NSIG; i++) {
if ((i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL)) {
if ((i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM)) {
signal(i, (void (*))die);
} else {
} else if ((i != SIGKILL) && (i != SIGSTOP)) {
signal(i, SIG_IGN);
}
}

View File

@@ -43,6 +43,7 @@
#include "outstat.h"
#include "nlinfo.h"
extern int most_debug;
extern int do_quiet; /* Suppress screen output */
int do_attach = FALSE; /* Send file attaches */
@@ -179,6 +180,8 @@ int main(int argc, char *argv[])
FILE *fl;
unsigned long cmmask;
most_debug = TRUE;
InitConfig();
InitNode();
InitFidonet();

View File

@@ -373,7 +373,7 @@ int poll(faddr *addr, int stop)
if (addr == NULL)
return 0;
pol = polname(addr);
pol = xstrcpy(polname(addr));
if (stop) {
if (access(pol, R_OK) == 0) {
@@ -393,18 +393,21 @@ int poll(faddr *addr, int stop)
Syslog('+', "Node %s not in nodelist", ascfnode(addr, 0x1f));
if (!do_quiet)
printf("Node %s not in nodelist", ascfnode(addr, 0x1f));
free(pol);
return MBERR_NODE_NOT_IN_LIST;
}
if (nlent->pflag == NL_DOWN) {
Syslog('+', "Node %s has status Down", ascfnode(addr, 0x1f));
if (!do_quiet)
printf("Node %s has status Down", ascfnode(addr, 0x1f));
free(pol);
return MBERR_NODE_MAY_NOT_CALL;
}
if (nlent->pflag == NL_HOLD) {
Syslog('+', "Node %s has status Hold", ascfnode(addr, 0x1f));
if (!do_quiet)
printf("Node %s has status Hold", ascfnode(addr, 0x1f));
free(pol);
return MBERR_NODE_MAY_NOT_CALL;
}
@@ -438,6 +441,7 @@ int poll(faddr *addr, int stop)
}
}
free(pol);
return 0;
}