nserver

nihilistic stats server
Log | Files | Refs | README | LICENSE

commit d5f23304ee49697df888e54ce7e54ef0823c098c
parent 0c05d9c9b0166ecfd64b1a64322006267d80a968
Author: rsiddharth <s@ricketyspace.net>
Date:   Sun, 19 Apr 2020 01:10:38 -0400

protocol.c: Update sslist.

* src/protocol.c (sslist): Clean up ks_str.

Diffstat:
src/protocol.c | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/protocol.c b/src/protocol.c @@ -198,6 +198,7 @@ void traverse_tree(void *value, void *data) char *sslist() { char *list = NULL, *tmp = NULL; + bstring ks_str = NULL; if (tst == NULL) { list = (char *) calloc(7 + 1, sizeof(char)); @@ -209,7 +210,7 @@ char *sslist() } // 1. Create "accumulator" string. - bstring ks_str = bfromcstr(""); + ks_str = bfromcstr(""); check(ks_str != NULL, "error creating keys_str"); // 2. Accumulate keys into "accumulator" string. @@ -224,11 +225,15 @@ char *sslist() list = strncpy(list, tmp, strlen(tmp)); // 4. Clean up. + bdestroy(ks_str); bcstrfree(tmp); // 3. Return result. return list; error: + if (ks_str) { + bdestroy(ks_str); + } if (tmp) { bcstrfree(tmp); }