From fe6e11556efe8a2271e8f5977f4f40fd18b3a820 Mon Sep 17 00:00:00 2001 From: Andrey Kiselev Date: Tue, 4 Feb 2003 08:51:38 +0000 Subject: [PATCH] Memory leak fixed. --- ChangeLog | 4 ++++ tools/raw2tiff.c | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b5a475a3..444080d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-02-04 Andrey Kiselev + + * tools/raw2tiff.c: Memory leak fixed. + 2003-02-03 Andrey Kiselev * tools/fax2tiff.c, man/fax2tiff.1: Applied patch from Julien Gaulmin diff --git a/tools/raw2tiff.c b/tools/raw2tiff.c index 0aae6545..ca4ea90a 100644 --- a/tools/raw2tiff.c +++ b/tools/raw2tiff.c @@ -1,11 +1,11 @@ -/* $Id: raw2tiff.c,v 1.2 2002-08-12 15:32:37 dron Exp $ +/* $Id: raw2tiff.c,v 1.3 2003-02-04 08:51:38 dron Exp $ * * Project: libtiff tools * Purpose: Convert raw byte sequences in TIFF images - * Author: Andrey Kiselev, a_kissel@eudoramail.com + * Author: Andrey Kiselev, dron@remotesensing.org * ****************************************************************************** - * Copyright (c) 2002, Andrey Kiselev + * Copyright (c) 2002, Andrey Kiselev * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided @@ -63,7 +63,7 @@ main(int argc, char* argv[]) uint32 row, col, band; int c; - unsigned char *buf, *buf1; + unsigned char *buf = NULL, *buf1 = NULL; extern int optind; extern char* optarg; @@ -263,7 +263,11 @@ main(int argc, char* argv[]) break; } } - (void) TIFFClose(out); + if (buf) + _TIFFfree(buf); + if (buf1) + _TIFFfree(buf1); + TIFFClose(out); return (0); }