[libvirt] [libvirt-php][PATCH 5/5] src: Don't leak connection_get_emulator retval

Erik Skultety eskultet at redhat.com
Mon Dec 11 08:02:18 UTC 2017


On Mon, Dec 11, 2017 at 07:34:59AM +0100, Michal Privoznik wrote:
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/libvirt-connection.c |  2 ++
>  src/libvirt-php.c        | 11 +++++++++--
>  2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/src/libvirt-connection.c b/src/libvirt-connection.c
> index 086cd57..9e70031 100644
> --- a/src/libvirt-connection.c
> +++ b/src/libvirt-connection.c
> @@ -404,6 +404,7 @@ PHP_FUNCTION(libvirt_connect_get_nic_models)
>      char cmd[4096] = { 0 };
>      char tmp2[16]  = { 0 };
>      snprintf(cmd, sizeof(cmd), "%s -net nic,model=? 2>&1", tmp);
> +    VIR_FREE(tmp);
>
>      FILE *fp = popen(cmd, "r");
>      if (fp == NULL)
> @@ -475,6 +476,7 @@ PHP_FUNCTION(libvirt_connect_get_soundhw_models)
>
>      char cmd[4096] = { 0 };
>      snprintf(cmd, sizeof(cmd), "%s -soundhw help 2>&1", tmp);
> +    VIR_FREE(tmp);
>


^These two are unrelated to the patch, either put them in a separate patch or
squash patches 2,4,5/5 into a single patch.

Reviewed-by: Erik Skultety <eskultet at redhat.com>




More information about the libvir-list mailing list