Index: src/logging.c =================================================================== RCS file: /data/cvs/libxen/src/logging.c,v retrieving revision 1.6 diff -u -r1.6 logging.c --- src/logging.c 15 Jan 2009 19:56:05 -0000 1.6 +++ src/logging.c 20 Jan 2009 19:33:28 -0000 @@ -626,14 +626,20 @@ return(len); } +static char *current_ident = NULL; + static void virLogCloseSyslog(void *data ATTRIBUTE_UNUSED) { + VIR_FREE(current_ident); closelog(); } -static int virLogAddOutputToSyslog(int priority, const char *ident) { +static int virLogAddOutputToSyslog(int priority, char *ident) { + VIR_FREE(current_ident); openlog(ident, 0, 0); + current_ident = ident; /* ident need to be kept around on Solaris */ if (virLogDefineOutput(virLogOutputToSyslog, virLogCloseSyslog, NULL, priority, 0) < 0) { + VIR_FREE(current_ident); closelog(); return(-1); } @@ -703,9 +709,12 @@ name = strndup(str, cur - str); if (name == NULL) return(-1); + /* + * name is consumed by virLogAddOutputToSyslog which + * keep the reference + * */ if (virLogAddOutputToSyslog(prio, name) == 0) ret++; - VIR_FREE(name); #endif /* HAVE_SYSLOG_H */ } else if (STREQLEN(cur, "file", 4)) { cur += 4;