[libvirt] [PATCH] storage: Fix a problem which will cause libvirtd crashed

--- src/conf/storage_conf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 6e3fe0e..13a3622 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -396,7 +396,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, char *authType = NULL; int nsource, i; virStoragePoolOptionsPtr options; - char *port; + char *port = NULL; relnode = ctxt->node; ctxt->node = node; -- 1.7.4

On Wed, Mar 16, 2011 at 03:03:07PM +0800, Osier Yang wrote:
--- src/conf/storage_conf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 6e3fe0e..13a3622 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -396,7 +396,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, char *authType = NULL; int nsource, i; virStoragePoolOptionsPtr options; - char *port; + char *port = NULL;
relnode = ctxt->node; ctxt->node = node; -- 1.7.4
It would be good to explain why, my understanding is that in case of error earlier than the initialization of port, we jump to cleanup: which does VIR_FREE(port) Based on this, ACK, 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/

于 2011年03月16日 16:07, Daniel Veillard 写道:
On Wed, Mar 16, 2011 at 03:03:07PM +0800, Osier Yang wrote:
--- src/conf/storage_conf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 6e3fe0e..13a3622 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -396,7 +396,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, char *authType = NULL; int nsource, i; virStoragePoolOptionsPtr options; - char *port; + char *port = NULL;
relnode = ctxt->node; ctxt->node = node; -- 1.7.4
It would be good to explain why, my understanding is that in case of error earlier than the initialization of port, we jump to cleanup: which does VIR_FREE(port)
Thanks, pushed with description added. Regards Osier
participants (2)
-
Daniel Veillard
-
Osier Yang