diff options
author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-05-29 19:13:51 +0200 |
---|---|---|
committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-06-06 18:16:12 +0200 |
commit | 5d806ec6e0bce5f1cd32b0d5386c1ad97c31c1f8 (patch) | |
tree | c025730971c6c8eb3351b439659a8a36b0e0369d /lib/frrstr.c | |
parent | lib: add vector_remove() to vector.[ch] (diff) | |
download | frr-5d806ec6e0bce5f1cd32b0d5386c1ad97c31c1f8.tar.xz frr-5d806ec6e0bce5f1cd32b0d5386c1ad97c31c1f8.zip |
lib: fix static analysis issues, use regfree()
* Fix potential NULL dereference
* Fix use of uninitialized value
* Fix leaking memory by not freeing regex_t
* Fix extra \n when using empty regex filter
* Clean up still-reachable hook memory
* Handle nonexistent pager
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/frrstr.c')
-rw-r--r-- | lib/frrstr.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/frrstr.c b/lib/frrstr.c index 03368b366..d003590ba 100644 --- a/lib/frrstr.c +++ b/lib/frrstr.c @@ -58,6 +58,9 @@ vector frrstr_split_vec(const char *string, const char *delimiter) char **result; int argc; + if (!string) + return NULL; + frrstr_split(string, delimiter, &result, &argc); vector v = array_to_vector((void **)result, argc); @@ -89,7 +92,7 @@ char *frrstr_join(const char **parts, int argc, const char *join) memcpy(p, parts[i], arglen); p += arglen; - if (i + 1 != argc) { + if (i + 1 != argc && join) { memcpy(p, join, joinlen); p += joinlen; } |