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
WARNING: DO NOT USE, PROBLEMS EXIST IN THIS CVS VERSION !!!!!!!!!!!!
general:
Since this version Posix threads are being used, please let
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
not yet installed binaries under debuggers.
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
were minor problems.
@ -24,20 +24,28 @@ v0.39.3 26-Nov-2003
libmsgbase:
In JAM_Open replaced a strcpy with memmove.
Fixed invalid memory read/write in Msg_Link.
libdbase:
Code cleanup in dbdupe.
libnodelist:
Fixed a small memeory leak.
mbcico:
Dropped binkp CRC support because it will be incompatible with
future extensions.
Fixed a small memory leak.
mbout:
Fixed several memory leaks.
mbfido:
Fixed a some small memory leaks.
mbfile:
Fixed a uninitialized memory pointer in the index command.
Fixed a 3 forgotten file closes in mbfile list.
mbindex:
Fixed a forgotten file close.
@ -75,7 +83,7 @@ v0.39.3 26-Nov-2003
script:
Changed all init scripts to allow the slower stopping of mbtask
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

7
TODO
View File

@ -114,8 +114,6 @@ mbfido:
N: After readalias we need to free the alias list when mbfido ends.
N: Tic, scan tests with valgrind.
mbcico:
N: Upgrade binkp protocol to 1.1.
@ -128,9 +126,6 @@ mbcico:
U: Fix binkp file resume when mbcico silently dies.
mbout:
N: Fix prepbuf in libcommon so that valgind can test this.
mbfile:
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.
N: Test with valgrind.
mbmsg:
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

View File

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

View File

@ -1088,6 +1088,8 @@ node *getnlent(faddr *addr)
fclose(fp);
nodebuf.addr.name = nodebuf.sysop;
if (nodebuf.addr.domain)
free(nodebuf.addr.domain);
nodebuf.addr.domain = xstrcpy(fdx.domain);
nodebuf.upnet = ndx.upnet;
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);
return buf;
}

View File

@ -104,6 +104,10 @@ void free_mem(void)
free(flags);
if (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);
Syslog(' ', "MBCICO finished in %s", t_elapsed(t_start, t_end));
/*
* Free memory
*/
free_mem();
deinitnl();

View File

@ -193,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 == 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);
else
else if ((i != SIGKILL) && (i != SIGSTOP))
signal(i, SIG_IGN);
}
@ -274,6 +274,7 @@ int main(int argc, char *argv[])
}
if (do_poll || do_stop) {
tidy_faddr(addr);
for (i = 3; i <= argc; i++) {
if (strncasecmp(argv[i-1], "-q", 2)) {
if ((addr = parsefaddr(argv[i-1])) == NULL)
@ -288,6 +289,7 @@ int main(int argc, char *argv[])
}
if (do_reset) {
tidy_faddr(addr);
for (i = 3; i <= argc; i++) {
if (strncasecmp(argv[i-1], "-q", 2)) {
if ((addr = parsefaddr(argv[i-1])) == NULL)
@ -314,6 +316,13 @@ int main(int argc, char *argv[])
}
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();
if (nlent->pflag == NL_DUMMY)
Fatal((char *)"Node is not in nodelist", MBERR_NODE_NOT_IN_LIST);
@ -359,6 +368,7 @@ int main(int argc, char *argv[])
break;
}
}
tidy_faddr(addr);
die(rc);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -773,11 +773,15 @@ int Save_Msg(int IsReply, faddr *Dest)
char *temp;
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;
if (!Open_Msgbase(msgs.Base, 'w'))
if (!Open_Msgbase(msgs.Base, 'w')) {
WriteError("Failed to open msgbase \"%s\"", msgs.Base);
return FALSE;
}
Msg.Written = Msg.Arrived = time(NULL) - (gmt_offset((time_t)0) * 60);
Msg.Local = TRUE;