mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 20:51:26 +00:00
remote_driver.c: avoid leak on OOM error path
* src/remote/remote_driver.c (doRemoteOpen): Don't leak a qparam_set buffer upon OOM error.
This commit is contained in:
parent
b2149d03b9
commit
b39ea45292
@ -2,7 +2,7 @@
|
|||||||
* remote_internal.c: driver to provide access to libvirtd running
|
* remote_internal.c: driver to provide access to libvirtd running
|
||||||
* on a remote machine
|
* on a remote machine
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009 Red Hat, Inc.
|
* Copyright (C) 2007-2010 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -370,6 +370,7 @@ doRemoteOpen (virConnectPtr conn,
|
|||||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
|
struct qparam_set *vars = NULL;
|
||||||
int wakeupFD[2] = { -1, -1 };
|
int wakeupFD[2] = { -1, -1 };
|
||||||
char *transport_str = NULL;
|
char *transport_str = NULL;
|
||||||
enum {
|
enum {
|
||||||
@ -458,7 +459,6 @@ doRemoteOpen (virConnectPtr conn,
|
|||||||
* feasibly it might contain variables needed by the real driver,
|
* feasibly it might contain variables needed by the real driver,
|
||||||
* although that won't be the case for now).
|
* although that won't be the case for now).
|
||||||
*/
|
*/
|
||||||
struct qparam_set *vars;
|
|
||||||
struct qparam *var;
|
struct qparam *var;
|
||||||
int i;
|
int i;
|
||||||
char *query;
|
char *query;
|
||||||
@ -551,6 +551,7 @@ doRemoteOpen (virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
free_qparam_set (vars);
|
free_qparam_set (vars);
|
||||||
|
vars = NULL;
|
||||||
} else {
|
} else {
|
||||||
/* Probe URI server side */
|
/* Probe URI server side */
|
||||||
name = strdup("");
|
name = strdup("");
|
||||||
@ -933,6 +934,8 @@ doRemoteOpen (virConnectPtr conn,
|
|||||||
|
|
||||||
out_of_memory:
|
out_of_memory:
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
|
if (vars)
|
||||||
|
free_qparam_set (vars);
|
||||||
|
|
||||||
failed:
|
failed:
|
||||||
/* Close the socket if we failed. */
|
/* Close the socket if we failed. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user