Thread (32 messages) 32 messages, 4 authors, 2013-04-17
STALE4850d
Revisions (2)
  1. v1 current
  2. v2 [diff vs current]

[PATCH 01/13] gatttool: Fix memory leak after parsing input line

From: Alvaro Silva <hidden>
Date: 2013-03-21 22:31:37
Subsystem: the rest · Maintainer: Linus Torvalds

From: Jefferson Delfes <redacted>

The callback is responsible for freeing input line buffer that comes
from rl_callback_handler_install().
---
 attrib/interactive.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/attrib/interactive.c b/attrib/interactive.c
index a99ad0a..9f72453 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -850,7 +850,7 @@ static void parse_line(char *line_read)
 	line_read = g_strstrip(line_read);
 
 	if (*line_read == '\0')
-		return;
+		goto done;
 
 	add_history(line_read);
 
@@ -866,6 +866,9 @@ static void parse_line(char *line_read)
 		printf("%s: command not found\n", argvp[0]);
 
 	g_strfreev(argvp);
+
+done:
+	free(line_read);
 }
 
 static gboolean prompt_read(GIOChannel *chan, GIOCondition cond,
-- 
1.7.9.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help