From: Rusty Russell Date: Tue, 21 Jun 2011 01:13:31 +0000 (+0930) Subject: tally: fix FreeBSD compile, memleak in tests. X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=0284423676209380a2e07086b9b356096a2f93e6 tally: fix FreeBSD compile, memleak in tests. Posix says ssize_t is in sys/types.h; on Linux stdlib.h is enough. --- diff --git a/ccan/tally/tally.c b/ccan/tally/tally.c index 0d019079..b1839bef 100644 --- a/ccan/tally/tally.c +++ b/ccan/tally/tally.c @@ -1,4 +1,3 @@ -#include "config.h" #include #include #include @@ -7,6 +6,7 @@ #include #include #include +#include #define SIZET_BITS (sizeof(size_t)*CHAR_BIT) diff --git a/ccan/tally/tally.h b/ccan/tally/tally.h index e7157175..650e2656 100644 --- a/ccan/tally/tally.h +++ b/ccan/tally/tally.h @@ -1,6 +1,7 @@ #ifndef CCAN_TALLY_H #define CCAN_TALLY_H -#include +#include "config.h" +#include struct tally; diff --git a/ccan/tally/test/run-mean.c b/ccan/tally/test/run-mean.c index a4a67cf9..b43dea6b 100644 --- a/ccan/tally/test/run-mean.c +++ b/ccan/tally/test/run-mean.c @@ -25,5 +25,6 @@ int main(void) ok1(tally_mean(tally) == 0); } + free(tally); return exit_status(); } diff --git a/ccan/tally/test/run-median.c b/ccan/tally/test/run-median.c index f461c2ec..b12fd8a0 100644 --- a/ccan/tally/test/run-median.c +++ b/ccan/tally/test/run-median.c @@ -40,6 +40,7 @@ int main(void) ok1(median - (ssize_t)err <= i/2 && median + (ssize_t)err >= i/2); } + free(tally); return exit_status(); } diff --git a/ccan/tally/test/run-min-max.c b/ccan/tally/test/run-min-max.c index ffb0f2ef..c92f6d38 100644 --- a/ccan/tally/test/run-min-max.c +++ b/ccan/tally/test/run-min-max.c @@ -16,5 +16,6 @@ int main(void) ok1(tally_max(tally) == i); ok1(tally_min(tally) == -i); } + free(tally); return exit_status(); } diff --git a/ccan/tally/test/run-mode.c b/ccan/tally/test/run-mode.c index 7216738b..cd2f2304 100644 --- a/ccan/tally/test/run-mode.c +++ b/ccan/tally/test/run-mode.c @@ -41,5 +41,6 @@ int main(void) ok1(mode - (ssize_t)err <= 0 && mode + (ssize_t)err >= 0); } + free(tally); return exit_status(); } diff --git a/ccan/tally/test/run-renormalize.c b/ccan/tally/test/run-renormalize.c index 7c141528..8fe9dbce 100644 --- a/ccan/tally/test/run-renormalize.c +++ b/ccan/tally/test/run-renormalize.c @@ -21,5 +21,6 @@ int main(void) ok1(tally->counts[0] == 2); ok1(tally->counts[1] == 0); + free(tally); return exit_status(); }