Re: [PATCH 5/9] BUG/MINOR: spoe: Fix memory leak if failing to allocate memory

2019-06-24 Thread Christopher Faulet

Le 23/06/2019 à 22:10, Tim Duesterhus a écrit :

Technically harmless, but it annoys clang analyzer.

This bug was introduced in 336d3ef0e77192582c98b3c578927a529ceadd9b.
This fix should be backported to HAProxy 1.9+.
---
  src/flt_spoe.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index f20b2640b..4e48aa95c 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -3751,6 +3751,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char 
**args, int kwm)
goto out;
}
if ((vph->name  = strdup(args[cur_arg])) == NULL) {
+   free(vph);
ha_alert("parsing [%s:%d] : out of memory.\n", 
file, linenum);
err_code |= ERR_ALERT | ERR_ABORT;
goto out;



Thanks, merged now.

--
Christopher Faulet



[PATCH 5/9] BUG/MINOR: spoe: Fix memory leak if failing to allocate memory

2019-06-23 Thread Tim Duesterhus
Technically harmless, but it annoys clang analyzer.

This bug was introduced in 336d3ef0e77192582c98b3c578927a529ceadd9b.
This fix should be backported to HAProxy 1.9+.
---
 src/flt_spoe.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/flt_spoe.c b/src/flt_spoe.c
index f20b2640b..4e48aa95c 100644
--- a/src/flt_spoe.c
+++ b/src/flt_spoe.c
@@ -3751,6 +3751,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char 
**args, int kwm)
goto out;
}
if ((vph->name  = strdup(args[cur_arg])) == NULL) {
+   free(vph);
ha_alert("parsing [%s:%d] : out of memory.\n", 
file, linenum);
err_code |= ERR_ALERT | ERR_ABORT;
goto out;
-- 
2.21.0