From: Charles Manning Date: Tue, 8 Jun 2021 03:47:57 +0000 (+1200) Subject: Fix unmatched temporary buffer allocations X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=42909262aa6077a60cf18dac024fd21df3b4b18a;hp=eea0b87b01437ed6db77e796c85d496ed94b3570 Fix unmatched temporary buffer allocations If there were errors then temporary buffers were not being freed properly. Signed-off-by: Charles Manning --- diff --git a/yaffs_guts.c b/yaffs_guts.c index a2b4cdf..3e33916 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -3017,8 +3017,10 @@ static void yaffs_check_obj_details_loaded(struct yaffs_obj *in) result = yaffs_rd_chunk_tags_nand(dev, in->hdr_chunk, buf, &tags); - if (result == YAFFS_FAIL) + if (result == YAFFS_FAIL) { + yaffs_release_temp_buffer(dev, buf); return; + } oh = (struct yaffs_obj_hdr *)buf; @@ -3201,7 +3203,6 @@ int yaffs_update_oh(struct yaffs_obj *in, const YCHAR *name, int force, bi->has_shrink_hdr = 1; } - return new_chunk_id; } diff --git a/yaffs_tagsmarshall.c b/yaffs_tagsmarshall.c index d568208..397715d 100644 --- a/yaffs_tagsmarshall.c +++ b/yaffs_tagsmarshall.c @@ -100,8 +100,12 @@ static int yaffs_tags_marshall_read(struct yaffs_dev *dev, BUG(); - if (retval == YAFFS_FAIL) + if (retval == YAFFS_FAIL) { + if (local_data) + yaffs_release_temp_buffer(dev, data); + return YAFFS_FAIL; + } if (dev->param.inband_tags) { if (tags) {