From: Andre Noll Date: Thu, 17 Jan 2008 20:59:01 +0000 (+0100) Subject: aft.c: Fix a memory leak in open_and_update_audio_file(). X-Git-Tag: v0.3.1~86 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=33fe4df2e6e28ea5972ccbfc15e6131e919ab177;p=paraslash.git aft.c: Fix a memory leak in open_and_update_audio_file(). If make_status_items() fails, we return an error but do not free the chunk table buffer. Also get rid of a pointless "goto err". --- diff --git a/aft.c b/aft.c index 0bf38fe6..d8436929 100644 --- a/aft.c +++ b/aft.c @@ -660,6 +660,7 @@ int open_and_update_audio_file(struct osl_row *aft_row, long score, AFTCOL_CHUNKS, &chunk_table_obj); if (ret < 0) return ret; + afd->afhi.chunk_table = NULL; ret = mmap_full_file(path, O_RDONLY, &map.data, &map.size, &afd->fd); if (ret < 0) @@ -697,10 +698,8 @@ int open_and_update_audio_file(struct osl_row *aft_row, long score, aced.old_afsi = &old_afsi; afs_event(AFSI_CHANGE, NULL, &aced); ret = save_afd(afd); - free(afd->afhi.chunk_table); - if (ret < 0) - goto err; err: + free(afd->afhi.chunk_table); osl_close_disk_object(&chunk_table_obj); return ret; }