summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cethcan/beanctr.c2
-rw-r--r--cethcan/main.c2
-rw-r--r--cethcan/rpc.c4
3 files changed, 7 insertions, 1 deletions
diff --git a/cethcan/beanctr.c b/cethcan/beanctr.c
index d381c79..9495376 100644
--- a/cethcan/beanctr.c
+++ b/cethcan/beanctr.c
@@ -83,7 +83,9 @@ int bean_init_conf(json_t *config)
b->name = strdup(json_string_value(json_object_get(config, "name")));
b->logical_addr = json_integer_value(json_object_get(config, "addr"));
b->vals[0] = json_array_get(vals, 0);
+ json_incref(b->vals[0]);
b->vals[1] = json_array_get(vals, 1);
+ json_incref(b->vals[1]);
b->u = can_register_alloc(b, bean_can_handler, "bean[%s]", b->name);
b->u->json = bean_json_handler;
diff --git a/cethcan/main.c b/cethcan/main.c
index 99a32c5..a870ca2 100644
--- a/cethcan/main.c
+++ b/cethcan/main.c
@@ -77,6 +77,8 @@ int main(int argc, char **argv)
http_init();
+ json_decref(config);
+
event_base_loop(ev_base, 0);
return 0;
}
diff --git a/cethcan/rpc.c b/cethcan/rpc.c
index fa11ecc..bfe6026 100644
--- a/cethcan/rpc.c
+++ b/cethcan/rpc.c
@@ -109,8 +109,10 @@ void rpc_perform(struct evbuffer *request,
/* TODO: asynchronous calls */
char *output = jsonrpc_handler(NULL, data, len, method_table);
- if (output)
+ if (output) {
evbuffer_add(outbuf, output, strlen(output));
+ free(output);
+ }
response_handler(handler_arg, outbuf);
evbuffer_free(outbuf);
}