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

@@ -145,13 +145,13 @@ 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 == SIGKILL) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
signal(i, (void (*))die);
else
else if ((i != SIGKILL) && (i != SIGSTOP))
signal(i, SIG_IGN);
}
if(argc < 2)
if (argc < 2)
Help();
cmd = xstrcpy((char *)"Command line: mball");
@@ -320,10 +320,11 @@ void Masterlist()
Syslog('+', "Inserting %s", temp);
while( fgets(temp, 80 ,pHeader) != NULL) {
Striplf(temp);
fprintf(fp, "%s\r\n", temp);
fprintf(np, "%s\r\n", temp);
Striplf(temp);
fprintf(fp, "%s\r\n", temp);
fprintf(np, "%s\r\n", temp);
}
fclose(pHeader);
}
while (fread(&area, areahdr.recsize, 1, pAreas) == 1) {
@@ -457,6 +458,7 @@ void Masterlist()
fprintf(fp, "%s\r\n", temp);
fprintf(np, "%s\r\n", temp);
}
fclose(pHeader);
}
fclose(fp);
@@ -505,6 +507,7 @@ void MakeArc()
(char *)"/dev/null", (char *)"/dev/null") == 0)
WriteError("Create newfiles.zip failed");
free(cmd);
cmd = NULL;
}

View File

@@ -125,6 +125,7 @@ int main(int argc, char **argv)
if ((tty = ttyname(0)) == NULL) {
WriteError("Not at a tty");
Free_Language();
Quick_Bye(MBERR_OK);
}
@@ -160,6 +161,7 @@ int main(int argc, char **argv)
*/
if (CheckStatus() == FALSE) {
Syslog('+', "Kicking user out, the BBS is closed");
Free_Language();
Quick_Bye(MBERR_OK);
}
@@ -192,6 +194,7 @@ int main(int argc, char **argv)
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
printf("No BBS on this port allowed!\n\n");
Free_Language();
Quick_Bye(MBERR_OK);
}

View File

@@ -122,7 +122,7 @@ int main(int argc, char **argv)
for (i = 0; i < NSIG; i++) {
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);
}

View File

@@ -387,7 +387,10 @@ void UserPack(int days, int level, int pack)
fclose(fout);
chmod(fnin, 0660);
Syslog('+', "Userbase is updated, written %d records", record);
} else {
fclose(fout);
}
unlink(fnout);
free(fnin);
free(fnout);

View File

@@ -211,6 +211,7 @@ void user()
printf("%s\n", (char *) Language(390));
Syslog('?', "FATAL: Could not find user in BBS users file.");
Syslog('?', " and system is using unix accounts\n");
Free_Language();
ExitClient(MBERR_OK);
}