aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-04-19 01:10:38 -0400
committerrsiddharth <s@ricketyspace.net>2020-04-19 01:10:38 -0400
commitd5f23304ee49697df888e54ce7e54ef0823c098c (patch)
tree01761d19c643a7600522d7b0b53cf6bce8e063f7
parent0c05d9c9b0166ecfd64b1a64322006267d80a968 (diff)
downloadnserver-d5f23304ee49697df888e54ce7e54ef0823c098c.tar.gz
nserver-d5f23304ee49697df888e54ce7e54ef0823c098c.tar.bz2
nserver-d5f23304ee49697df888e54ce7e54ef0823c098c.tar.xz
nserver-d5f23304ee49697df888e54ce7e54ef0823c098c.zip
protocol.c: Update sslist.
* src/protocol.c (sslist): Clean up ks_str.
-rw-r--r--src/protocol.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/protocol.c b/src/protocol.c
index 77b806a..aca5f94 100644
--- 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);
}