Fix unmatched temporary buffer allocations
authorCharles Manning <cdhmanning@gmail.com>
Tue, 8 Jun 2021 03:47:57 +0000 (15:47 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Tue, 8 Jun 2021 03:48:49 +0000 (15:48 +1200)
If there were errors then temporary buffers were not being freed properly.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
yaffs_guts.c
yaffs_tagsmarshall.c

index a2b4cdf696114a2d89ab639c1ab0f35ee126221b..3e33916b16045824f25cde00d2a0b3ea329a926c 100644 (file)
@@ -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;
 }
 
index d568208e91bd53ece6b685707ecca481c693c183..397715dbc9eb00f27a79afbd3a5910352e2768bc 100644 (file)
@@ -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) {