This defect was found by the coccinelle script "unchecked-strdup.cocci".
It can be backported to all supported branches.
---
 src/cfgparse-tcp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/cfgparse-tcp.c b/src/cfgparse-tcp.c
index 2f68daf1c..2c214f3d8 100644
--- a/src/cfgparse-tcp.c
+++ b/src/cfgparse-tcp.c
@@ -144,6 +144,10 @@ static int bind_parse_interface(char **args, int cur_arg, 
struct proxy *px, stru
 
        ha_free(&conf->settings.interface);
        conf->settings.interface = strdup(args[cur_arg + 1]);
+       if (!conf->settings.interface) {
+               memprintf(err, "'%s %s' : out of memory", args[cur_arg], 
args[cur_arg + 1]);
+               return ERR_ALERT | ERR_FATAL;
+       }
        return 0;
 }
 #endif
-- 
2.46.0.windows.1



Reply via email to