From: Jes.Sorensen@redhat.com
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org
Subject: [PATCH 01/11] Fix memory leaks in reshape_array()
Date: Mon, 31 Oct 2011 15:02:29 +0100 [thread overview]
Message-ID: <1320069759-13361-2-git-send-email-Jes.Sorensen@redhat.com> (raw)
In-Reply-To: <1320069759-13361-1-git-send-email-Jes.Sorensen@redhat.com>
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
Grow.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/Grow.c b/Grow.c
index 08581d2..05350dd 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1882,8 +1882,8 @@ static int reshape_array(char *container, int fd, char *devname,
struct mddev_dev *dv;
int added_disks;
- int *fdlist;
- unsigned long long *offsets;
+ int *fdlist = NULL;
+ unsigned long long *offsets = NULL;
int d;
int nrdisks;
int err;
@@ -2339,6 +2339,9 @@ started:
abort_reshape(sra);
goto release;
default:
+ free(fdlist);
+ free(offsets);
+ sysfs_free(sra);
return 0;
case 0:
map_fork();
@@ -2366,6 +2369,9 @@ started:
d - odisks, fdlist+odisks,
offsets+odisks);
+ free(fdlist);
+ free(offsets);
+
if (backup_file && done)
unlink(backup_file);
if (!done) {
@@ -2381,6 +2387,7 @@ started:
/* no need to wait for the reshape to finish as
* there is nothing more to do.
*/
+ sysfs_free(sra);
exit(0);
}
wait_reshape(sra);
@@ -2445,17 +2452,21 @@ started:
st->update_tail = NULL;
}
out:
+ sysfs_free(sra);
if (forked)
return 0;
unfreeze(st);
exit(0);
release:
+ free(fdlist);
+ free(offsets);
if (orig_level != UnSet && sra) {
c = map_num(pers, orig_level);
if (c && sysfs_set_str(sra, NULL, "level", c) == 0)
fprintf(stderr, Name ": aborting level change\n");
}
+ sysfs_free(sra);
if (!forked)
unfreeze(st);
return 1;
--
1.7.6.4
next prev parent reply other threads:[~2011-10-31 14:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-31 14:02 [PATCH 00/11] Memory/resource leaks and unchecked return fixes Jes.Sorensen
2011-10-31 14:02 ` Jes.Sorensen [this message]
2011-10-31 14:02 ` [PATCH 02/11] Fix memory leak Jes.Sorensen
2011-10-31 14:02 ` [PATCH 03/11] " Jes.Sorensen
2011-10-31 14:02 ` [PATCH 04/11] Fix memory leak of 'st3' in array_try_spare() Jes.Sorensen
2011-10-31 14:02 ` [PATCH 05/11] partition_try_spare() use closedir() to release DIR * returned by opendir() Jes.Sorensen
2011-10-31 14:02 ` [PATCH 06/11] Fix memory leak Jes.Sorensen
2011-10-31 14:02 ` [PATCH 07/11] Add missing return in case of trying to grow sub-array Jes.Sorensen
2011-10-31 14:02 ` [PATCH 08/11] Avoid memory leak Jes.Sorensen
2011-10-31 14:02 ` [PATCH 09/11] policy_add(): Add missing va_end() Jes.Sorensen
2011-10-31 14:02 ` [PATCH 10/11] Write_rules(): Avoid stack corruption if using extremely long udev pathname Jes.Sorensen
2011-10-31 14:02 ` [PATCH 11/11] mdmon(): Error out if failing to connect to victim monitor Jes.Sorensen
2011-11-01 3:57 ` [PATCH 00/11] Memory/resource leaks and unchecked return fixes NeilBrown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1320069759-13361-2-git-send-email-Jes.Sorensen@redhat.com \
--to=jes.sorensen@redhat.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).