From 7374d172f37f2f793ef506765518ea744b753c21 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 4 Jul 2019 14:38:37 +0200 Subject: src: use malloc() and free() from cli and main xmalloc() and xfree() are internal symbols of the library, do not use them. Fixes: 16543a0136c0 ("libnftables: export public symbols only") Reported-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- src/cli.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/cli.c') diff --git a/src/cli.c b/src/cli.c index ca3869ab..bbdd0fdb 100644 --- a/src/cli.c +++ b/src/cli.c @@ -63,9 +63,15 @@ static char *cli_append_multiline(char *line) rl_set_prompt(".... "); } else { len += strlen(multiline); - s = xmalloc(len + 1); + s = malloc(len + 1); + if (!s) { + fprintf(stderr, "%s:%u: Memory allocation failure\n", + __FILE__, __LINE__); + cli_exit(); + exit(EXIT_FAILURE); + } snprintf(s, len + 1, "%s%s", multiline, line); - xfree(multiline); + free(multiline); multiline = s; } line = NULL; @@ -111,7 +117,7 @@ static void cli_complete(char *line) add_history(line); nft_run_cmd_from_buffer(cli_nft, line); - xfree(line); + free(line); } static char **cli_completion(const char *text, int start, int end) -- cgit v1.2.3