NeilBrown: Free mdstat data structures properly.

Martin F. Krafft madduck at alioth.debian.org
Mon Feb 16 10:52:45 UTC 2009


Module: mdadm
Branch: master
Commit: 89a10d84cb76492b7d8ea96d0a206b54702bcaff
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=89a10d84cb76492b7d8ea96d0a206b54702bcaff

Author: NeilBrown <neilb at suse.de>
Date:   Thu Jan  8 09:25:31 2009 +1100

Free mdstat data structures properly.

In one case we called 'free' instead of 'mdstat_free'.
In others we didn't free at all.

Signed-off-by: NeilBrown <neilb at suse.de>

---

 Monitor.c |    2 +-
 mapfile.c |    1 +
 mdadm.c   |    2 ++
 3 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/Monitor.c b/Monitor.c
index abc2dbd..2f0fe0c 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -619,7 +619,7 @@ int Wait(char *dev)
 			free_mdstat(ms);
 			return rv;
 		}
-		free(ms);
+		free_mdstat(ms);
 		rv = 0;
 		mdstat_wait(5);
 	}
diff --git a/mapfile.c b/mapfile.c
index 0d0aa39..59cc6c6 100644
--- a/mapfile.c
+++ b/mapfile.c
@@ -245,6 +245,7 @@ void RebuildMap(void)
 			break;
 		}
 	}
+	free_mdstat(mdstat);
 	map_write(map);
 	map_free(map);
 }
diff --git a/mdadm.c b/mdadm.c
index d680ea7..6609bf2 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1217,6 +1217,7 @@ int main(int argc, char *argv[])
 							     export, test, homehost);
 						put_md_name(name);
 					}
+					free_mdstat(ms);
 				} else	if (devmode == 'S' && scan) {
 					/* apply --stop to all devices in /proc/mdstat */
 					/* Due to possible stacking of devices, repeat until
@@ -1249,6 +1250,7 @@ int main(int argc, char *argv[])
 
 							put_md_name(name);
 						}
+						free_mdstat(ms);
 					} while (!last && err);
 					if (err) rv |= 1;
 				} else {




More information about the pkg-mdadm-commits mailing list