[libvirt] [PATCH] Fix openlog() ident usage

# HG changeset patch # User john.levon@sun.com # Date 1232478815 28800 # Node ID 37a6a671e38d7f4449d3b47bc5cf06c19362bc41 # Parent 15bfba92a98744f8c554757ed608c3bf89fa38aa Fix openlog() ident usage It cannot be freed, as it's used by reference in the syslog code, at least on Solaris. Signed-off-by: John Levon <john.levon@sun.com> diff --git a/src/logging.c b/src/logging.c --- a/src/logging.c +++ b/src/logging.c @@ -705,7 +705,10 @@ int virLogParseOutputs(const char *outpu return(-1); if (virLogAddOutputToSyslog(prio, name) == 0) ret++; - VIR_FREE(name); + /* + * Do *NOT* free(name) - openlog() uses this string by + * reference, instead of keeping its own copy. + */ #endif /* HAVE_SYSLOG_H */ } else if (STREQLEN(cur, "file", 4)) { cur += 4;

On Tue, Jan 20, 2009 at 11:14:03AM -0800, john.levon@sun.com wrote:
# HG changeset patch # User john.levon@sun.com # Date 1232478815 28800 # Node ID 37a6a671e38d7f4449d3b47bc5cf06c19362bc41 # Parent 15bfba92a98744f8c554757ed608c3bf89fa38aa Fix openlog() ident usage
It cannot be freed, as it's used by reference in the syslog code, at least on Solaris.
The requirement is apparently not present on Linux, sorry :-) I would prefer to keep the reference around and not leak it for example on reloads Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Tue, Jan 20, 2009 at 08:36:27PM +0100, Daniel Veillard wrote:
On Tue, Jan 20, 2009 at 11:14:03AM -0800, john.levon@sun.com wrote:
It cannot be freed, as it's used by reference in the syslog code, at least on Solaris.
The requirement is apparently not present on Linux, sorry :-)
I would prefer to keep the reference around and not leak it for example on reloads
Another version with an extra strdup but making clearer what the change do and fixing the closelog/free order, if tested positively please apply, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Tue, Jan 20, 2009 at 10:18:31PM +0100, Daniel Veillard wrote:
On Tue, Jan 20, 2009 at 08:36:27PM +0100, Daniel Veillard wrote:
On Tue, Jan 20, 2009 at 11:14:03AM -0800, john.levon@sun.com wrote:
It cannot be freed, as it's used by reference in the syslog code, at least on Solaris.
The requirement is apparently not present on Linux, sorry :-)
I would prefer to keep the reference around and not leak it for example on reloads
Another version with an extra strdup but making clearer what the change do and fixing the closelog/free order,
if tested positively please apply, thanks !
ACK, I like this version Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Tue, Jan 20, 2009 at 09:20:24PM +0000, Daniel P. Berrange wrote:
On Tue, Jan 20, 2009 at 10:18:31PM +0100, Daniel Veillard wrote:
On Tue, Jan 20, 2009 at 08:36:27PM +0100, Daniel Veillard wrote:
On Tue, Jan 20, 2009 at 11:14:03AM -0800, john.levon@sun.com wrote:
It cannot be freed, as it's used by reference in the syslog code, at least on Solaris.
The requirement is apparently not present on Linux, sorry :-)
I would prefer to keep the reference around and not leak it for example on reloads
Another version with an extra strdup but making clearer what the change do and fixing the closelog/free order,
if tested positively please apply, thanks !
ACK, I like this version
Okay I pushed after John ACK'ed on IRC too, thanks, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (3)
-
Daniel P. Berrange
-
Daniel Veillard
-
john.levon@sun.com