From c0359c8aa4c6e919a9338402ca0084e581b51fe6 Mon Sep 17 00:00:00 2001 From: jylam <jylam@92316355-f0b4-4df1-b90c-862c8a59935f> Date: Fri, 24 Oct 2008 11:49:56 +0000 Subject: [PATCH] * Fixed a memory leak in histogram example git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3082 92316355-f0b4-4df1-b90c-862c8a59935f --- examples/histogram.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/histogram.c b/examples/histogram.c index d6b2893..d93c3db 100644 --- a/examples/histogram.c +++ b/examples/histogram.c @@ -10,7 +10,7 @@ int main(int argc, char *argv[]) { char *srcname = NULL, *dstname = NULL; pipi_image_t *img, *newimg, *tmp; - pipi_histogram_t* histogram; + pipi_histogram_t* histogram = NULL; int ret = 0; if(argc < 2) { @@ -37,12 +37,13 @@ int main(int argc, char *argv[]) histogram = pipi_new_histogram(); pipi_get_image_histogram(tmp, histogram, PIPI_COLOR_R|PIPI_COLOR_G|PIPI_COLOR_B); - pipi_render_histogram(tmp, histogram, PIPI_COLOR_R|PIPI_COLOR_G|PIPI_COLOR_B); + pipi_free_histogram(histogram); + pipi_save(tmp, dstname); pipi_free(newimg); - + pipi_free(tmp); return ret; }