diff options
| author | Daniel Friesel <derf@finalrewind.org> | 2020-04-08 16:12:16 +0200 | 
|---|---|---|
| committer | Daniel Friesel <derf@finalrewind.org> | 2020-04-08 16:12:16 +0200 | 
| commit | eaceb6aa881b97de6a7661096b9fa07ea30c269d (patch) | |
| tree | 369cde6f82b61fb8d6a4a2d9a36f9ef57a226ec7 /src | |
| parent | 825472556866f473e577c150fed8da9eb84d5b79 (diff) | |
fix a memory leak when loading a non-native image more than once
feh_file_info_load is called even if file_info is already populated, so
the original file_info struct is never freed. This results in a leak of
~44 Byte for each subsequenc image load
Diffstat (limited to 'src')
| -rw-r--r-- | src/imlib.c | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/src/imlib.c b/src/imlib.c index 8baa886..1cc253c 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -254,7 +254,19 @@ int feh_load_image(Imlib_Image * im, feh_file * file)  		if (!err && im) {  			real_filename = file->filename;  			file->filename = tmpname; + +			/* +			 * feh does not associate a non-native image with its temporary +			 * filename and may delete the temporary file right after loading. +			 * To ensure that it is still aware of image size, dimensions, etc., +			 * file_info is preloaded here. To avoid a memory leak when loading +			 * a non-native file multiple times in a slideshow, the file_info +			 * struct is freed first. If file->info is not set, feh_file_info_free +			 * is a no-op. +			 */ +			feh_file_info_free(file->info);  			feh_file_info_load(file, *im); +  			file->filename = real_filename;  #ifdef HAVE_LIBEXIF  			file->ed = exif_get_data(tmpname); | 
