[libvirt] [PATCH] esx: Fix a potential crash

Initialize ptr data.datastorePathWithoutFileName as NULL, otherwise it might cause crash when trying to free it in cleanup. --- src/esx/esx_driver.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index ddb8c23..ae614a6 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2698,6 +2698,7 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) char *vmx = NULL; virVMXContext ctx; esxVMX_Data data; + data.datastorePathWithoutFileName = NULL; virDomainDefPtr def = NULL; char *xml = NULL; -- 1.7.6

On Tue, Jul 12, 2011 at 05:05:16PM +0800, Osier Yang wrote:
Initialize ptr data.datastorePathWithoutFileName as NULL, otherwise it might cause crash when trying to free it in cleanup.
--- src/esx/esx_driver.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index ddb8c23..ae614a6 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2698,6 +2698,7 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) char *vmx = NULL; virVMXContext ctx; esxVMX_Data data; + data.datastorePathWithoutFileName = NULL; virDomainDefPtr def = NULL; char *xml = NULL;
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年07月12日 16:58, Daniel Veillard 写道:
On Tue, Jul 12, 2011 at 05:05:16PM +0800, Osier Yang wrote:
Initialize ptr data.datastorePathWithoutFileName as NULL, otherwise it might cause crash when trying to free it in cleanup.
--- src/esx/esx_driver.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index ddb8c23..ae614a6 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2698,6 +2698,7 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) char *vmx = NULL; virVMXContext ctx; esxVMX_Data data; + data.datastorePathWithoutFileName = NULL; virDomainDefPtr def = NULL; char *xml = NULL; ACK,
Daniel
Thanks, applied Osier

2011/7/12 Osier Yang <jyang@redhat.com>:
于 2011年07月12日 16:58, Daniel Veillard 写道:
On Tue, Jul 12, 2011 at 05:05:16PM +0800, Osier Yang wrote:
Initialize ptr data.datastorePathWithoutFileName as NULL, otherwise it might cause crash when trying to free it in cleanup.
--- src/esx/esx_driver.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index ddb8c23..ae614a6 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2698,6 +2698,7 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) char *vmx = NULL; virVMXContext ctx; esxVMX_Data data; + data.datastorePathWithoutFileName = NULL; virDomainDefPtr def = NULL; char *xml = NULL;
ACK,
Daniel
Thanks, applied
Osier
Yes, this fixes the problem. I'd like to propose this more general approach here. -- Matthias Bolte http://photron.blogspot.com

于 2011年07月12日 17:50, Matthias Bolte 写道:
2011/7/12 Osier Yang<jyang@redhat.com>:
于 2011年07月12日 16:58, Daniel Veillard 写道:
On Tue, Jul 12, 2011 at 05:05:16PM +0800, Osier Yang wrote:
Initialize ptr data.datastorePathWithoutFileName as NULL, otherwise it might cause crash when trying to free it in cleanup.
--- src/esx/esx_driver.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index ddb8c23..ae614a6 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2698,6 +2698,7 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) char *vmx = NULL; virVMXContext ctx; esxVMX_Data data; + data.datastorePathWithoutFileName = NULL; virDomainDefPtr def = NULL; char *xml = NULL; ACK,
Daniel
Thanks, applied
Osier Yes, this fixes the problem.
I'd like to propose this more general approach here.
Yes, this is more general, and fix all the similiar problems, ACK, please revert my commit if need when you push. Thanks Regards Osier

2011/7/12 Osier Yang <jyang@redhat.com>:
于 2011年07月12日 17:50, Matthias Bolte 写道:
2011/7/12 Osier Yang<jyang@redhat.com>:
于 2011年07月12日 16:58, Daniel Veillard 写道:
On Tue, Jul 12, 2011 at 05:05:16PM +0800, Osier Yang wrote:
Initialize ptr data.datastorePathWithoutFileName as NULL, otherwise it might cause crash when trying to free it in cleanup.
--- src/esx/esx_driver.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index ddb8c23..ae614a6 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2698,6 +2698,7 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags) char *vmx = NULL; virVMXContext ctx; esxVMX_Data data; + data.datastorePathWithoutFileName = NULL; virDomainDefPtr def = NULL; char *xml = NULL;
ACK,
Daniel
Thanks, applied
Osier
Yes, this fixes the problem.
I'd like to propose this more general approach here.
Yes, this is more general, and fix all the similiar problems, ACK, please revert my commit if need when you push. Thanks
Regards Osier
Pushed now, thanks. -- Matthias Bolte http://photron.blogspot.com
participants (3)
-
Daniel Veillard
-
Matthias Bolte
-
Osier Yang