mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
cli/lightning-cli: free eveything on exit.
It's not required, but it means valgrind won't complain about leaks. Suggested-by: @m-schmoock Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
628b65fb40
commit
e902d9af56
@ -604,6 +604,8 @@ int main(int argc, char *argv[])
|
||||
tal_free(rpc_filename);
|
||||
tal_free(ctx);
|
||||
opt_free_table();
|
||||
free(resp);
|
||||
free(toks);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -618,5 +620,7 @@ int main(int argc, char *argv[])
|
||||
tal_free(rpc_filename);
|
||||
tal_free(ctx);
|
||||
opt_free_table();
|
||||
free(resp);
|
||||
free(toks);
|
||||
return 1;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ int test_getpid(void);
|
||||
int test_printf(const char *format, ...);
|
||||
void *test_malloc(size_t n);
|
||||
void *test_realloc(void *p, size_t n);
|
||||
void test_free(void *p);
|
||||
|
||||
#define main test_main
|
||||
#define read test_read
|
||||
@ -25,6 +26,7 @@ void *test_realloc(void *p, size_t n);
|
||||
#define printf test_printf
|
||||
#define malloc test_malloc
|
||||
#define realloc test_realloc
|
||||
#define free test_free
|
||||
|
||||
#include "../lightning-cli.c"
|
||||
#undef main
|
||||
@ -71,6 +73,11 @@ void *test_realloc(void *p, size_t n)
|
||||
return p;
|
||||
}
|
||||
|
||||
void test_free(void *p)
|
||||
{
|
||||
tal_free(p);
|
||||
}
|
||||
|
||||
ssize_t test_read(int fd UNUSED, void *buf, size_t len)
|
||||
{
|
||||
if (len > max_read_return)
|
||||
|
Loading…
Reference in New Issue
Block a user