[libvirt] [PATCH 1/2] parallels: fix parallelsDoCmdRun in case of command failure

Don't try to dereferece NULL pointer. --- src/parallels/parallels_utils.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/parallels/parallels_utils.c b/src/parallels/parallels_utils.c index 35766b7..89a0d89 100644 --- a/src/parallels/parallels_utils.c +++ b/src/parallels/parallels_utils.c @@ -55,7 +55,7 @@ parallelsDoCmdRun(char **outbuf, const char *binary, va_list list) cleanup: VIR_FREE(scmd); virCommandFree(cmd); - if (ret) + if (ret && outbuf) VIR_FREE(*outbuf); return ret; } -- 1.7.1

virDomainDefParseString assigns 0 to port if autoport enabled. So fix code, which check different between old and new configurations. --- src/parallels/parallels_driver.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index fd6ba88..9eb2526 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -1223,7 +1223,7 @@ parallelsApplyGraphicsParams(virDomainGraphicsDefPtr *oldgraphics, int nold, new = newgraphics[0]; if (old->data.vnc.port != new->data.vnc.port && - (old->data.vnc.port != 0 && new->data.vnc.port != -1)) { + (old->data.vnc.port != 0 && new->data.vnc.port != 0)) { goto error; } else if (old->data.vnc.autoport != new->data.vnc.autoport || -- 1.7.1

On Mon, Sep 10, 2012 at 07:23:43PM +0400, Dmitry Guryanov wrote:
Don't try to dereferece NULL pointer. --- src/parallels/parallels_utils.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/parallels/parallels_utils.c b/src/parallels/parallels_utils.c index 35766b7..89a0d89 100644 --- a/src/parallels/parallels_utils.c +++ b/src/parallels/parallels_utils.c @@ -55,7 +55,7 @@ parallelsDoCmdRun(char **outbuf, const char *binary, va_list list) cleanup: VIR_FREE(scmd); virCommandFree(cmd); - if (ret) + if (ret && outbuf) VIR_FREE(*outbuf); return ret; } -- 1.7.1
ACK, the two patches are no-brainer fixes, pushed, 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 (2)
-
Daniel Veillard
-
Dmitry Guryanov