summaryrefslogtreecommitdiff
blob: 979bf74a0ea82f742ebcedddb9c78cc1d29d16af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
https://bugs.gentoo.org/276352

From 3a4d9869d47c462c84688b0f8b15df5ab6f93381 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Thu, 2 Jul 2009 13:54:22 -0400
Subject: [PATCH] resize2fs: Fix error message so the mountpoint is printed correctly

The resize2fs program was freeing the mountpoint information too
early, so garbage was getting printed instead of the correct
information in an error message.

Addresses-Debian-Bug: #535452

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 resize/main.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/resize/main.c b/resize/main.c
index 9b03ba9..2dae161 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -250,10 +250,8 @@ int main (int argc, char ** argv)
 				device_name);
 			exit(1);
 		}
-		if (!(mount_flags & EXT2_MF_MOUNTED) || (mtpt[len-1] == 0)) {
-			free(mtpt);
+		if (!(mount_flags & EXT2_MF_MOUNTED) || (mtpt[len-1] == 0))
 			break;
-		}
 		free(mtpt);
 		len = 2 * len;
 	}
@@ -453,6 +451,7 @@ int main (int argc, char ** argv)
 				   ((flags & RESIZE_PERCENT_COMPLETE) ?
 				    resize_progress_func : 0));
 	}
+	free(mtpt);
 	if (retval) {
 		com_err(program_name, retval, _("while trying to resize %s"),
 			device_name);
-- 
1.6.3.3