From: Christopher Faulet Date: Mon, 18 May 2020 10:14:18 +0000 (+0200) Subject: MINOR: config: Don't dump keywords if argument is NULL X-Git-Tag: v2.2-dev8~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=784063eeb2160d089a321544a6b0e8637d487308;p=thirdparty%2Fhaproxy.git MINOR: config: Don't dump keywords if argument is NULL Helper functions are used to dump bind, server or filter keywords. These functions are used to report errors during the configuration parsing. To have a coherent API, these functions are now prepared to handle a null pointer as argument. If so, no action is performed and functions immediately return. This patch should fix the issue #631. It is not a bug. There is no reason to backport it. --- diff --git a/src/filters.c b/src/filters.c index e275050408..07b9043165 100644 --- a/src/filters.c +++ b/src/filters.c @@ -142,6 +142,9 @@ flt_dump_kws(char **out) struct flt_kw_list *kwl; int index; + if (!out) + return; + *out = NULL; list_for_each_entry(kwl, &flt_keywords.list, list) { for (index = 0; kwl->kw[index].kw != NULL; index++) { diff --git a/src/listener.c b/src/listener.c index 829dc99b74..01feee58f2 100644 --- a/src/listener.c +++ b/src/listener.c @@ -1255,6 +1255,9 @@ void bind_dump_kws(char **out) struct bind_kw_list *kwl; int index; + if (!out) + return; + *out = NULL; list_for_each_entry(kwl, &bind_keywords.list, list) { for (index = 0; kwl->kw[index].kw != NULL; index++) { diff --git a/src/server.c b/src/server.c index 265106eb87..e4044cd7a6 100644 --- a/src/server.c +++ b/src/server.c @@ -247,6 +247,9 @@ void srv_dump_kws(char **out) struct srv_kw_list *kwl; int index; + if (!out) + return; + *out = NULL; list_for_each_entry(kwl, &srv_keywords.list, list) { for (index = 0; kwl->kw[index].kw != NULL; index++) {