From 42909262aa6077a60cf18dac024fd21df3b4b18a Mon Sep 17 00:00:00 2001 From: Charles Manning Date: Tue, 8 Jun 2021 15:47:57 +1200 Subject: [PATCH] Fix unmatched temporary buffer allocations If there were errors then temporary buffers were not being freed properly. Signed-off-by: Charles Manning --- yaffs_guts.c | 5 +++-- yaffs_tagsmarshall.c | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) 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) { -- 2.30.2