summaryrefslogtreecommitdiff
path: root/replay.c
diff options
context:
space:
mode:
Diffstat (limited to 'replay.c')
-rw-r--r--replay.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/replay.c b/replay.c
index cda8fb3..de11988 100644
--- a/replay.c
+++ b/replay.c
@@ -461,6 +461,7 @@ long lastspokelinenumber(char *nick, char *basedir) {
// Try to split
if ((token = strsep(&strcopy, " ")) == NULL) {
debugprint(DEBUG_CRIT, "lastspokelinenumber(): error splitting string on iteration '%d', returning -1!\n", i);
+ fclose(fp);
return -1;
}
// Copy into the token array (strlen + 1 to get the NULL terminator)
@@ -472,12 +473,14 @@ long lastspokelinenumber(char *nick, char *basedir) {
// Make sure there were at least three tokens
if (counter < 3) {
debugprint(DEBUG_CRIT, "lastspokelinenumber(): not enough tokens on line, only '%d', returning -1!\n", counter);
+ fclose(fp);
return -1;
}
// Make sure it started with a valid timestamp
int timestamp = gettimestamp(tokens[0]);
if (timestamp < 0) {
+ fclose(fp);
debugprint(DEBUG_CRIT, "lastspokelinenumber(): line didn't start with a timestamp, returning -1!\n", counter);
}
@@ -622,6 +625,7 @@ int doreplaylastspoke(int sourcefd, long linenumber, struct client *clients, str
snprintf(outgoingmsg, MAXDATASIZE, "NOTICE %s :Log replay complete.", ircdstate->ircnick);
sendtoclient(sourcefd, outgoingmsg, clients, settings, 0);
+ fclose(fp);
return 1;
}