[PATCH 08/25] network: fix memory leak in networkBuildDhcpDaemonCommandLine()

Laine Stump posted 25 patches 5 years, 7 months ago
[PATCH 08/25] network: fix memory leak in networkBuildDhcpDaemonCommandLine()
Posted by Laine Stump 5 years, 7 months ago
hostsfilestr was not being freed. This will be turned into g_autofree
in an upcoming patch converting a lot more of the same file to using
g_auto*, but I wanted to make a separate patch for this first so the
other patch is simpler to review.

Signed-off-by: Laine Stump <laine@redhat.com>
---
 src/network/bridge_driver.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 47d5d95678..aff1b7b1bc 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1628,6 +1628,7 @@ networkBuildDhcpDaemonCommandLine(virNetworkDriverStatePtr driver,
     virObjectUnref(dnsmasq_caps);
     VIR_FREE(configfile);
     VIR_FREE(configstr);
+    VIR_FREE(hostsfilestr);
     VIR_FREE(leaseshelper_path);
     return ret;
 }
-- 
2.25.4

Re: [PATCH 08/25] network: fix memory leak in networkBuildDhcpDaemonCommandLine()
Posted by Ján Tomko 5 years, 7 months ago
On a Wednesday in 2020, Laine Stump wrote:
>hostsfilestr was not being freed. This will be turned into g_autofree
>in an upcoming patch converting a lot more of the same file to using
>g_auto*, but I wanted to make a separate patch for this first so the
>other patch is simpler to review.
>

It also makes it easier to backport just the fix without the refactor.

Fixes: 97a0aa246799c97d0a9ca9ecd6b4fd932ae4756c

>Signed-off-by: Laine Stump <laine@redhat.com>
>---
> src/network/bridge_driver.c | 1 +
> 1 file changed, 1 insertion(+)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano