]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: Apply ha_free.cocci
authorTim Duesterhus <tim@bastelstu.be>
Thu, 4 Nov 2021 20:03:52 +0000 (21:03 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 5 Nov 2021 06:48:38 +0000 (07:48 +0100)
Use `ha_free()` where possible.

src/action.c
src/server.c
src/ssl_ckch.c

index ba465a25321b33177ef40a8fe4490445ef2be1c1..1de97692eea3fe750e737ab568d46203aba933ad 100644 (file)
@@ -39,8 +39,7 @@ int check_action_rules(struct list *rules, struct proxy *px, int *err_code)
                        err++;
                }
                *err_code |= warnif_tcp_http_cond(px, rule->cond);
-               free(errmsg);
-               errmsg = NULL;
+               ha_free(&errmsg);
        }
 
        return err;
index a0206021ddd4f2d35c9ff11b5ed2cd7abb38b533..a8e85a982ef5df3b69ec09b434e95ea38bc3b843 100644 (file)
@@ -2380,8 +2380,7 @@ struct server *srv_drop(struct server *srv)
 
        EXTRA_COUNTERS_FREE(srv->extra_counters);
 
-       free(srv);
-       srv = NULL;
+       ha_free(&srv);
 
  end:
        return next;
index 2378ee349f2947adac5cdd629455f5cb400e6632..eeb031b27e96ca53f0ad351b4561b80a8ae8e81d 100644 (file)
@@ -2506,8 +2506,7 @@ end:
                appctx->ctx.ssl.new_cafile_entry = NULL;
                appctx->ctx.ssl.old_cafile_entry = NULL;
 
-               free(appctx->ctx.ssl.path);
-               appctx->ctx.ssl.path = NULL;
+               ha_free(&appctx->ctx.ssl.path);
 
                HA_SPIN_UNLOCK(CKCH_LOCK, &ckch_lock);
                return cli_dynerr(appctx, memprintf(&err, "%sCan't update %s!\n", err ? err : "", args[3]));
@@ -3225,8 +3224,7 @@ end:
                appctx->ctx.ssl.new_crlfile_entry = NULL;
                appctx->ctx.ssl.old_crlfile_entry = NULL;
 
-               free(appctx->ctx.ssl.path);
-               appctx->ctx.ssl.path = NULL;
+               ha_free(&appctx->ctx.ssl.path);
 
                HA_SPIN_UNLOCK(CKCH_LOCK, &ckch_lock);
                return cli_dynerr(appctx, memprintf(&err, "%sCan't update %s!\n", err ? err : "", args[3]));