summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Walsh <dwalsh@redhat.com>2005-07-21 19:42:34 +0000
committerDan Walsh <dwalsh@redhat.com>2005-07-21 19:42:34 +0000
commit8b8611bf410d86e5ee0a3e000c37d2640759c239 (patch)
tree58330a93a9ecf167694c771cbabe8241b8d230b1
parent92b2216c0bcc4d2e45516203ee16246cb480bcf5 (diff)
downloadinitscripts-8b8611bf410d86e5ee0a3e000c37d2640759c239.tar.gz
initscripts-8b8611bf410d86e5ee0a3e000c37d2640759c239.tar.xz
initscripts-8b8611bf410d86e5ee0a3e000c37d2640759c239.zip
Fix invalid free
-rw-r--r--src/initlog.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/initlog.c b/src/initlog.c
index 19d9f9aa..ae110675 100644
--- a/src/initlog.c
+++ b/src/initlog.c
@@ -284,11 +284,12 @@ int logEvent(char *cmd, int eventtype,char *string) {
struct logInfo logentry;
if (cmd) {
- logentry.cmd = strdup(basename(cmd));
+ logentry.cmd = basename(cmd);
if ((logentry.cmd[0] =='K' || logentry.cmd[0] == 'S') &&
( logentry.cmd[1] >= '0' && logentry.cmd[1] <= '9' ) &&
( logentry.cmd[2] >= '0' && logentry.cmd[2] <= '9' ) )
logentry.cmd+=3;
+ logentry.cmd = strdup(logentry.cmd);
} else
logentry.cmd = strdup(_("(none)"));
if (!string) {
@@ -317,11 +318,12 @@ int logString(char *cmd, char *string) {
int rc;
if (cmd) {
- logentry.cmd = strdup(basename(cmd));
+ logentry.cmd = basename(cmd);
if ((logentry.cmd[0] =='K' || logentry.cmd[0] == 'S') &&
( logentry.cmd[1] >= '0' && logentry.cmd[1] <= 0x39 ) &&
( logentry.cmd[2] >= '0' && logentry.cmd[2] <= 0x39 ) )
logentry.cmd+=3;
+ logentry.cmd = strdup(logentry.cmd);
} else
logentry.cmd = strdup(_(""));
logentry.line = strdup(string);