mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 15:33:56 +00:00
lib: Fix uninitialized pointer segfault
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
ff35126c06
commit
fe2e10e8d8
@ -453,13 +453,7 @@ doc_next()
|
|||||||
static struct graph_node *
|
static struct graph_node *
|
||||||
new_token_node (struct graph *graph, enum cmd_token_type_t type, char *text, char *doc)
|
new_token_node (struct graph *graph, enum cmd_token_type_t type, char *text, char *doc)
|
||||||
{
|
{
|
||||||
struct cmd_token_t *token =
|
struct cmd_token_t *token = new_cmd_token (type, text, doc);
|
||||||
XMALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_token_t));
|
|
||||||
|
|
||||||
token->type = type;
|
|
||||||
token->text = text;
|
|
||||||
token->desc = doc;
|
|
||||||
|
|
||||||
return graph_new_node (graph, token, (void (*)(void *)) &del_cmd_token);
|
return graph_new_node (graph, token, (void (*)(void *)) &del_cmd_token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,9 +289,15 @@ new_cmd_token (enum cmd_token_type_t type, char *text, char *desc)
|
|||||||
void
|
void
|
||||||
del_cmd_token (struct cmd_token_t *token)
|
del_cmd_token (struct cmd_token_t *token)
|
||||||
{
|
{
|
||||||
|
if (!token) return;
|
||||||
|
|
||||||
|
if (token->text)
|
||||||
XFREE (MTYPE_CMD_TOKENS, token->text);
|
XFREE (MTYPE_CMD_TOKENS, token->text);
|
||||||
|
if (token->desc)
|
||||||
XFREE (MTYPE_CMD_TOKENS, token->desc);
|
XFREE (MTYPE_CMD_TOKENS, token->desc);
|
||||||
|
if (token->arg)
|
||||||
XFREE (MTYPE_CMD_TOKENS, token->arg);
|
XFREE (MTYPE_CMD_TOKENS, token->arg);
|
||||||
|
|
||||||
XFREE (MTYPE_CMD_TOKENS, token);
|
XFREE (MTYPE_CMD_TOKENS, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user