This reapplies ha_free.cocci across the whole src/ tree.
---
 src/haterm_init.c | 3 +--
 src/tools.c       | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/haterm_init.c b/src/haterm_init.c
index a56ac3eb3..f43ca5630 100644
--- a/src/haterm_init.c
+++ b/src/haterm_init.c
@@ -80,8 +80,7 @@ static struct hbuf *hbuf_alloc(struct hbuf *h)
 
 static inline void free_hbuf(struct hbuf *h)
 {
-       free(h->area);
-       h->area = NULL;
+       ha_free(&h->area);
 }
 
 __attribute__ ((format(printf, 2, 3)))
diff --git a/src/tools.c b/src/tools.c
index 2687c2cdc..3adc7cf3f 100644
--- a/src/tools.c
+++ b/src/tools.c
@@ -7565,8 +7565,7 @@ int backup_env(void)
                                free(*tmp);
                                tmp++;
                        }
-                       free(init_env);
-                       init_env = NULL;
+                       ha_free(&init_env);
                        return -1;
                }
                tmp++;
@@ -7761,8 +7760,7 @@ void ha_freearray(char ***array)
        char **r = *array;
 
        for (i = 0; r && r[i]; i++) {
-               free(r[i]);
-               r[i] = NULL;
+               ha_free(&r[i]);
        }
        *array = NULL;
 }
-- 
2.53.0



Reply via email to