Blame SOURCES/0015-UI-Avoid-memory-leaks.patch
|
|
0cb0b9 |
From 059c9548534bef5b0312ac7089eb60e8596469be Mon Sep 17 00:00:00 2001
|
|
|
0cb0b9 |
From: Amarnath Valluri <amarnath.valluri@intel.com>
|
|
|
0cb0b9 |
Date: Fri, 31 Jul 2015 12:12:44 +0300
|
|
|
0cb0b9 |
Subject: [PATCH 15/18] UI: Avoid memory leaks.
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
* parted/ui.c(command_line_get_sector): Don't leak input string.
|
|
|
0cb0b9 |
* parted/ui.c(command_line_prompt_words): Don't leak _def string in
|
|
|
0cb0b9 |
opt script mode.
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
Signed-off-by: Amarnath Valluri <amarnath.valluri@intel.com>
|
|
|
0cb0b9 |
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
|
0cb0b9 |
(cherry picked from commit 50dc0862a94a3e6e77d4cfb2af21de117fbb4819)
|
|
|
0cb0b9 |
---
|
|
|
0cb0b9 |
parted/ui.c | 6 +++++-
|
|
|
0cb0b9 |
1 file changed, 5 insertions(+), 1 deletion(-)
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
diff --git a/parted/ui.c b/parted/ui.c
|
|
|
0cb0b9 |
index 7365e7d..505b8ac 100644
|
|
|
0cb0b9 |
--- a/parted/ui.c
|
|
|
0cb0b9 |
+++ b/parted/ui.c
|
|
|
0cb0b9 |
@@ -829,8 +829,11 @@ command_line_prompt_words (const char* prompt, const char* def,
|
|
|
0cb0b9 |
}
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
if (opt_script_mode) {
|
|
|
0cb0b9 |
- if (_def)
|
|
|
0cb0b9 |
+ if (_def) {
|
|
|
0cb0b9 |
command_line_push_line (_def, 0);
|
|
|
0cb0b9 |
+ if (_def_needs_free)
|
|
|
0cb0b9 |
+ free (_def);
|
|
|
0cb0b9 |
+ }
|
|
|
0cb0b9 |
return;
|
|
|
0cb0b9 |
}
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
@@ -938,6 +941,7 @@ command_line_get_sector (const char* prompt, PedDevice* dev, PedSector* value,
|
|
|
0cb0b9 |
if (range) {
|
|
|
0cb0b9 |
*range = ped_geometry_new (dev, *value, 1);
|
|
|
0cb0b9 |
free (def_str);
|
|
|
0cb0b9 |
+ free (input);
|
|
|
0cb0b9 |
return *range != NULL;
|
|
|
0cb0b9 |
}
|
|
|
0cb0b9 |
|
|
|
0cb0b9 |
--
|
|
|
0cb0b9 |
2.4.3
|
|
|
0cb0b9 |
|