[LEDE-DEV] [PATCH] libubux: add 2 missing free calls and change a char to const char.

Rosen Penev rosenp at gmail.com
Mon Oct 30 18:49:13 PDT 2017


Reduces compiled size by 48 bytes.

Signed-off-by: Rosen Penev <rosenp at gmail.com>
---
 jshn.c    | 4 +++-
 ustream.c | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/jshn.c b/jshn.c
index 4989099..d47e98d 100644
--- a/jshn.c
+++ b/jshn.c
@@ -103,7 +103,7 @@ static void write_key_string(const char *key)
 
 static int add_json_element(const char *key, json_object *obj)
 {
-	char *type;
+	const char *type;
 
 	if (!obj)
 		return -1;
@@ -354,6 +354,8 @@ int main(int argc, char **argv)
 		avl_insert(&env_vars, &vars[i].avl);
 	}
 
+	free(vars);
+
 	while ((ch = getopt(argc, argv, "p:nir:w")) != -1) {
 		switch(ch) {
 		case 'p':
diff --git a/ustream.c b/ustream.c
index d36ce08..1cb0faf 100644
--- a/ustream.c
+++ b/ustream.c
@@ -70,6 +70,7 @@ static int ustream_alloc_default(struct ustream *s, struct ustream_buf_list *l)
 
 	ustream_init_buf(buf, l->buffer_len);
 	ustream_add_buf(l, buf);
+	free(buf);
 
 	return 0;
 }
-- 
2.13.6




More information about the Lede-dev mailing list