Re: [PATCH 15/14] xfs_io: free memory on error path exit from bmap_f()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/09/14 17:18, Eric Sandeen wrote:
If realloc() fails, the memory it was trying to realloc remains;
free it on the error path.

Signed-off-by: Eric Sandeen<sandeen@xxxxxxxxxx>
---

diff --git a/io/bmap.c b/io/bmap.c
index a78cbb1..8e5d75e 100644
--- a/io/bmap.c
+++ b/io/bmap.c
@@ -227,6 +227,7 @@ bmap_f(
  				fprintf(stderr,
  					_("%s: cannot realloc %d bytes\n"),
  					progname, (int)(map_size*sizeof(*map)));
+				free(map);
  				exitcode = 1;
  				return 0;
  			}


Didn't it get into this block by comparing map to NULL?

--Mark.

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux