summaryrefslogtreecommitdiff
path: root/os/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/log.c')
-rw-r--r--os/log.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/os/log.c b/os/log.c
index ee4b45fa4..d77708ea6 100644
--- a/os/log.c
+++ b/os/log.c
@@ -177,7 +177,6 @@ LogInit(const char *fname, const char *backup)
char *logFileName = NULL;
if (fname && *fname) {
- /* malloc() can't be used yet. */
logFileName = malloc(strlen(fname) + strlen(display) + 1);
if (!logFileName)
FatalError("Cannot allocate space for the log file name\n");
@@ -302,17 +301,10 @@ LogVWrite(int verb, const char *f, va_list args)
#endif
}
} else if (needBuffer) {
- /*
- * Note, this code is used before OsInit() has been called, so
- * malloc() and friends can't be used.
- */
if (len > bufferUnused) {
bufferSize += 1024;
bufferUnused += 1024;
- if (saveBuffer)
- saveBuffer = realloc(saveBuffer, bufferSize);
- else
- saveBuffer = malloc(bufferSize);
+ saveBuffer = realloc(saveBuffer, bufferSize);
if (!saveBuffer)
FatalError("realloc() failed while saving log messages\n");
}
@@ -489,8 +481,7 @@ AuditFlush(OsTimerPtr timer, CARD32 now, pointer arg)
ErrorF("%slast message repeated %d times\n",
prefix != NULL ? prefix : "", nrepeat);
nrepeat = 0;
- if (prefix != NULL)
- free(prefix);
+ free(prefix);
return AUDIT_TIMEOUT;
} else {
/* if the timer expires without anything to print, flush the message */
@@ -523,8 +514,7 @@ VAuditF(const char *f, va_list args)
nrepeat = 0;
auditTimer = TimerSet(auditTimer, 0, AUDIT_TIMEOUT, AuditFlush, NULL);
}
- if (prefix != NULL)
- free(prefix);
+ free(prefix);
}
void