[PATCH] Patched a mem leak that might arise when using the print command.

Matt Davis mattdavis9 at gmail.com
Thu May 1 03:50:17 UTC 2008


Deallocated memory allocated for returning a word from the command line.
---
 parted/parted.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/parted/parted.c b/parted/parted.c
index 0f6768b..cccc4da 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1294,17 +1294,20 @@ do_print (PedDevice** dev)
         peek_word = command_line_peek_word ();
         if (peek_word) {
                 if (strncmp (peek_word, "devices", 7) == 0) {
-                        command_line_pop_word();
+                        tmp = command_line_pop_word();
                         has_devices_arg = 1;
+                        ped_free (tmp);
                 }
                 else if (strncmp (peek_word, "free", 4) == 0) {
-                        command_line_pop_word ();
+                        tmp = command_line_pop_word ();
                         has_free_arg = 1;
+                        ped_free (tmp);
                 } 
                 else if (strncmp (peek_word, "list", 4) == 0 ||
                          strncmp (peek_word, "all", 3) == 0) {
-                        command_line_pop_word();
+                        tmp = command_line_pop_word();
                         has_list_arg = 1;
+                        ped_free (tmp);
                 }
                 else
                         has_num_arg = isdigit(peek_word[0]);
-- 
1.5.1.5


--9jxsPFA5p3P2qPhR--



More information about the parted-devel mailing list