BUG/MINOR: http_htx: Fix some leaks on error path when error files are loaded
No backports needed. This patch partially fixes the issue #457.
diff --git a/src/http_htx.c b/src/http_htx.c
index 016fd8f..d818170 100644
--- a/src/http_htx.c
+++ b/src/http_htx.c
@@ -946,6 +946,7 @@
http_err->node.key = strdup(file);
if (!http_err->node.key) {
memprintf(errmsg, "out of memory.");
+ free(http_err);
goto out;
}
@@ -996,6 +997,7 @@
http_err->node.key = strdup(key);
if (!http_err->node.key) {
memprintf(errmsg, "out of memory.");
+ free(http_err);
goto out;
}
@@ -1199,7 +1201,6 @@
conf_err = calloc(1, sizeof(*conf_err));
if (!name || !conf_err) {
memprintf(err, "%s : out of memory.", args[0]);
- ret = -1;
goto error;
}
conf_err->type = 0;
@@ -1222,8 +1223,7 @@
}
if (rc >= HTTP_ERR_SIZE) {
memprintf(err, "%s : status code '%d' not handled.", args[0], status);
- ret = -1;
- goto out;
+ goto error;
}
}
}
@@ -1236,6 +1236,7 @@
error:
free(name);
free(conf_err);
+ ret = -1;
goto out;
}