diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-10-05 10:51:01 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-10-05 10:53:13 -0400 |
| commit | affe9e99831408960b8b6f8477506ed2874a05dd (patch) | |
| tree | a6f2f7a898fad5fcdc3f74b233095b6e8f6a2b46 /lib/grammar_sandbox.c | |
| parent | ad183f047cab21576a42a9da0c4ed94cd1391005 (diff) | |
*: Convert list_delete(struct list *) to ** to allow nulling
Convert the list_delete(struct list *) function to use
struct list **. This is to allow the list pointer to be nulled.
I keep running into uses of this list_delete function where we
forget to set the returned pointer to NULL and attempt to use
it and then experience a crash, usually after the developer
has long since left the building.
Let's make the api explicit in it setting the list pointer
to null.
Cynical Prediction: This code will expose a attempt
to use the NULL'ed list pointer in some obscure bit
of code.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/grammar_sandbox.c')
| -rw-r--r-- | lib/grammar_sandbox.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 3c6396f347..66b042ad97 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -141,7 +141,7 @@ DEFUN (grammar_test_complete, vty_out(vty, "%% No match\n"); // free resources - list_delete(completions); + list_delete_and_null(&completions); cmd_free_strvec(command); XFREE(MTYPE_TMP, cmdstr); @@ -185,7 +185,7 @@ DEFUN (grammar_test_match, vty_out(vty, "func: %p\n", element->func); - list_delete(argvv); + list_delete_and_null(&argvv); } else { assert(MATCHER_ERROR(result)); switch (result) { @@ -426,7 +426,7 @@ DEFUN (grammar_findambig, } prev = cur; } - list_delete(commands); + list_delete_and_null(&commands); vty_out(vty, "\n"); } while (scan && scannode < LINK_PARAMS_NODE); |
