Final updates after valgrind tests

This commit is contained in:
Michiel Broek 2003-12-08 18:01:25 +00:00
parent 14232958a4
commit 49328fa66c
13 changed files with 54 additions and 22 deletions

View File

@ -2,7 +2,6 @@ $Id$
v0.39.3 26-Nov-2003 v0.39.3 26-Nov-2003
WARNING: DO NOT USE, PROBLEMS EXIST IN THIS CVS VERSION !!!!!!!!!!!!
general: general:
Since this version Posix threads are being used, please let Since this version Posix threads are being used, please let
me know if this doesn't compile on you system. me know if this doesn't compile on you system.
@ -10,7 +9,8 @@ v0.39.3 26-Nov-2003
are stripped during make install only. This allows to run the are stripped during make install only. This allows to run the
not yet installed binaries under debuggers. not yet installed binaries under debuggers.
The configure script has a --enable-debugging option so that The configure script has a --enable-debugging option so that
all code can be compiled to let it run under debuggers. all code can be compiled to let it run under debuggers. Not
usefull for production systems.
This version had a lot of testing using valgrind. Most errors This version had a lot of testing using valgrind. Most errors
were minor problems. were minor problems.
@ -24,20 +24,28 @@ v0.39.3 26-Nov-2003
libmsgbase: libmsgbase:
In JAM_Open replaced a strcpy with memmove. In JAM_Open replaced a strcpy with memmove.
Fixed invalid memory read/write in Msg_Link.
libdbase: libdbase:
Code cleanup in dbdupe. Code cleanup in dbdupe.
libnodelist:
Fixed a small memeory leak.
mbcico: mbcico:
Dropped binkp CRC support because it will be incompatible with Dropped binkp CRC support because it will be incompatible with
future extensions. future extensions.
Fixed a small memory leak. Fixed a small memory leak.
mbout:
Fixed several memory leaks.
mbfido: mbfido:
Fixed a some small memory leaks. Fixed a some small memory leaks.
mbfile: mbfile:
Fixed a uninitialized memory pointer in the index command. Fixed a uninitialized memory pointer in the index command.
Fixed a 3 forgotten file closes in mbfile list.
mbindex: mbindex:
Fixed a forgotten file close. Fixed a forgotten file close.
@ -75,7 +83,7 @@ v0.39.3 26-Nov-2003
script: script:
Changed all init scripts to allow the slower stopping of mbtask Changed all init scripts to allow the slower stopping of mbtask
For the latest Slackware distros a setup script for pkgtool is For the latest Slackware distros a setup script for pkgtool is
added. added. Most other distro's don't need this.
v0.39.2 21-Nov-2003 - 26-Nov-2003 v0.39.2 21-Nov-2003 - 26-Nov-2003

7
TODO
View File

@ -114,8 +114,6 @@ mbfido:
N: After readalias we need to free the alias list when mbfido ends. N: After readalias we need to free the alias list when mbfido ends.
N: Tic, scan tests with valgrind.
mbcico: mbcico:
N: Upgrade binkp protocol to 1.1. N: Upgrade binkp protocol to 1.1.
@ -128,9 +126,6 @@ mbcico:
U: Fix binkp file resume when mbcico silently dies. U: Fix binkp file resume when mbcico silently dies.
mbout:
N: Fix prepbuf in libcommon so that valgind can test this.
mbfile: mbfile:
L: Add a check to see if the magic filenames are (still) valid. L: Add a check to see if the magic filenames are (still) valid.
@ -140,8 +135,6 @@ mbfile:
L: Possibility to skip file areas from checking and reindexing. L: Possibility to skip file areas from checking and reindexing.
N: Test with valgrind.
mbmsg: mbmsg:
N: With the post command if a netmail area is used the netmail area N: With the post command if a netmail area is used the netmail area
will cause trouble later, should be blocked to be used on netmail will cause trouble later, should be blocked to be used on netmail

View File

@ -4,7 +4,7 @@
* Purpose ...............: Global message base functions * Purpose ...............: Global message base functions
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2003
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -363,8 +363,8 @@ int Msg_Link(char *Path, int do_quiet, int slow_util)
if ((Total = Msg_Number()) != 0L) { if ((Total = Msg_Number()) != 0L) {
if (Msg_Lock(30L)) { if (Msg_Lock(30L)) {
if ((Link = (MSGLINK *)malloc(Total * sizeof(MSGLINK))) != NULL) { if ((Link = (MSGLINK *)malloc((Total + 1) * sizeof(MSGLINK))) != NULL) {
memset(Link, 0, Total * sizeof(MSGLINK)); memset(Link, 0, (Total + 1) * sizeof(MSGLINK));
Number = Msg_Lowest(); Number = Msg_Lowest();
i = 0; i = 0;
do { do {

View File

@ -1088,6 +1088,8 @@ node *getnlent(faddr *addr)
fclose(fp); fclose(fp);
nodebuf.addr.name = nodebuf.sysop; nodebuf.addr.name = nodebuf.sysop;
if (nodebuf.addr.domain)
free(nodebuf.addr.domain);
nodebuf.addr.domain = xstrcpy(fdx.domain); nodebuf.addr.domain = xstrcpy(fdx.domain);
nodebuf.upnet = ndx.upnet; nodebuf.upnet = ndx.upnet;
nodebuf.upnode = ndx.upnode; nodebuf.upnode = ndx.upnode;

View File

@ -285,6 +285,7 @@ char *arcname(faddr *addr, unsigned short Zone, int ARCmailCompat)
} }
} }
tidy_faddr(bestaka);
Syslog('O', "Arc file name is \"%s\"", buf); Syslog('O', "Arc file name is \"%s\"", buf);
return buf; return buf;
} }

View File

@ -104,6 +104,10 @@ void free_mem(void)
free(flags); free(flags);
if (uxoutbound) if (uxoutbound)
free(uxoutbound); free(uxoutbound);
if (protocol)
free(protocol);
if ((nlent) && (nlent->url))
free(nlent->url);
} }
@ -137,6 +141,9 @@ void die(int onsig)
t_end = time(NULL); t_end = time(NULL);
Syslog(' ', "MBCICO finished in %s", t_elapsed(t_start, t_end)); Syslog(' ', "MBCICO finished in %s", t_elapsed(t_start, t_end));
/*
* Free memory
*/
free_mem(); free_mem();
deinitnl(); deinitnl();

View File

@ -193,9 +193,9 @@ int main(int argc, char *argv[])
* Catch all signals we can, and ignore the rest. * Catch all signals we can, and ignore the rest.
*/ */
for (i = 0; i < NSIG; i++) { for (i = 0; i < NSIG; i++) {
if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL)) if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
signal(i, (void (*))die); signal(i, (void (*))die);
else else if ((i != SIGKILL) && (i != SIGSTOP))
signal(i, SIG_IGN); signal(i, SIG_IGN);
} }
@ -274,6 +274,7 @@ int main(int argc, char *argv[])
} }
if (do_poll || do_stop) { if (do_poll || do_stop) {
tidy_faddr(addr);
for (i = 3; i <= argc; i++) { for (i = 3; i <= argc; i++) {
if (strncasecmp(argv[i-1], "-q", 2)) { if (strncasecmp(argv[i-1], "-q", 2)) {
if ((addr = parsefaddr(argv[i-1])) == NULL) if ((addr = parsefaddr(argv[i-1])) == NULL)
@ -288,6 +289,7 @@ int main(int argc, char *argv[])
} }
if (do_reset) { if (do_reset) {
tidy_faddr(addr);
for (i = 3; i <= argc; i++) { for (i = 3; i <= argc; i++) {
if (strncasecmp(argv[i-1], "-q", 2)) { if (strncasecmp(argv[i-1], "-q", 2)) {
if ((addr = parsefaddr(argv[i-1])) == NULL) if ((addr = parsefaddr(argv[i-1])) == NULL)
@ -314,6 +316,13 @@ int main(int argc, char *argv[])
} }
nlent = getnlent(addr); nlent = getnlent(addr);
if (nlent->addr.domain)
free(nlent->addr.domain);
nlent->addr.domain = NULL;
if (nlent->url)
free(nlent->url);
nlent->url = NULL;
cmmask = getCMmask(); cmmask = getCMmask();
if (nlent->pflag == NL_DUMMY) if (nlent->pflag == NL_DUMMY)
Fatal((char *)"Node is not in nodelist", MBERR_NODE_NOT_IN_LIST); Fatal((char *)"Node is not in nodelist", MBERR_NODE_NOT_IN_LIST);
@ -359,6 +368,7 @@ int main(int argc, char *argv[])
break; break;
} }
} }
tidy_faddr(addr);
die(rc); die(rc);
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: MBSE BBS Outbound Manager - show node info * Purpose ...............: MBSE BBS Outbound Manager - show node info
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2003
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -135,6 +135,8 @@ int nlinfo(faddr *addr)
if (nlent->addr.domain) if (nlent->addr.domain)
free(nlent->addr.domain); free(nlent->addr.domain);
if (nlent->url)
free(nlent->url);
return 0; return 0;
} }

View File

@ -439,6 +439,8 @@ int poll(faddr *addr, int stop)
} }
CreateSema((char *)"scanout"); CreateSema((char *)"scanout");
} }
if (nlent->url)
free(nlent->url);
} }
free(pol); free(pol);

View File

@ -54,8 +54,8 @@ extern int tcp_mode;
extern pid_t mypid; extern pid_t mypid;
node *nlent; node *nlent = NULL;
fa_list *remote=NULL; fa_list *remote = NULL;
int session_flags; int session_flags;
int remote_flags; int remote_flags;

View File

@ -4,7 +4,7 @@
* Purpose: File Database Maintenance - List areas and totals * Purpose: File Database Maintenance - List areas and totals
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2002 * Copyright (C) 1997-2003
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -169,6 +169,7 @@ void ListFileAreas(int Area)
printf("-"); printf("-");
printf("\n"); printf("\n");
printf("%d file%s, %ld Kbytes\n", fcount, (fcount == 1) ? "":"s", fsize); printf("%d file%s, %ld Kbytes\n", fcount, (fcount == 1) ? "":"s", fsize);
fclose(pFile);
} else { } else {
WriteError("Area %d is not available", Area); WriteError("Area %d is not available", Area);
@ -176,6 +177,7 @@ void ListFileAreas(int Area)
return; return;
} }
fclose(pAreas);
fclose(pTic); fclose(pTic);
free(ticarea); free(ticarea);
free(sAreas); free(sAreas);
@ -220,6 +222,7 @@ void ListFileAreas(int Area)
printf("%5d %5d %5ld %-12s %s\n", i, fcount, fsize, area.BbsGroup, area.Name); printf("%5d %5d %5ld %-12s %s\n", i, fcount, fsize, area.BbsGroup, area.Name);
iTotal++; iTotal++;
fclose(pFile);
} }
} }

View File

@ -701,7 +701,7 @@ int Fs_Edit()
clear(); clear();
fflush(stdout); fflush(stdout);
if (ch == 'S' && Changed) { if (ch == 'S' && Changed) {
Syslog('+', "FSEDIT: Message saved"); Syslog('+', "FSEDIT: Message will be saved");
return TRUE; return TRUE;
} else { } else {
Syslog('+', "FSEDIT: Message aborted"); Syslog('+', "FSEDIT: Message aborted");

View File

@ -773,11 +773,15 @@ int Save_Msg(int IsReply, faddr *Dest)
char *temp; char *temp;
FILE *fp; FILE *fp;
if ((Line < 2) || (Dest == NULL)) Syslog('b', "Entering Save_Msg() Line=%d, Dest=%s", Line, (Dest == NULL)?"NULL":"valid");
if (Line < 2)
return TRUE; return TRUE;
if (!Open_Msgbase(msgs.Base, 'w')) if (!Open_Msgbase(msgs.Base, 'w')) {
WriteError("Failed to open msgbase \"%s\"", msgs.Base);
return FALSE; return FALSE;
}
Msg.Written = Msg.Arrived = time(NULL) - (gmt_offset((time_t)0) * 60); Msg.Written = Msg.Arrived = time(NULL) - (gmt_offset((time_t)0) * 60);
Msg.Local = TRUE; Msg.Local = TRUE;