summaryrefslogtreecommitdiff
path: root/cethcan/rpc.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2013-10-10 23:20:40 +0000
committerroot <root@beaglebone.local.sublab.org>2013-10-10 23:20:40 +0000
commitf12be4da8d9520be572c142ae276f3b96f292fee (patch)
tree6917fc20de5c9a0f35f9130603985ca2e4a96f36 /cethcan/rpc.c
parentecfa61ab231482d6403add3f163250564824fc62 (diff)
cethcan: fix memory management
- primary config structure no longer left allocated in main() - memleak in RPC result buffer handling
Diffstat (limited to 'cethcan/rpc.c')
-rw-r--r--cethcan/rpc.c4
1 files changed, 3 insertions, 1 deletions
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);
}