On 2/12/21 11:07 PM, Laine Stump wrote:
These are all cases when 1) the pointer is passed by reference from
the caller (ie.e. **) and expects it to be NULL on return if there is
an error, or 2) the variable holding the pointer is being checked or
re-used in the same function, but not right away.
Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/esx/esx_network_driver.c | 2 +-
src/esx/esx_util.c | 8 ++++----
src/esx/esx_vi.c | 4 ++--
src/esx/esx_vi_types.c | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c
index b489f4de8a..4d0fba8c9f 100644
--- a/src/esx/esx_network_driver.c
+++ b/src/esx/esx_network_driver.c
@@ -914,7 +914,7 @@ esxConnectListAllNetworks(virConnectPtr conn,
if (nets && *nets) {
for (i = 0; i < count; ++i)
g_free((*nets)[i]);
- VIR_FREE(*nets);
+ g_clear_pointer(nets, g_free);
This is one of the reasons I'm not fan of dropping our fine crafted
utils and replace them with glib. But I don't want to stand in way to
progress.
Michal