[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tyndur-devel] [PATCH] libc: Memleak in readline



! libc: Fix fuer ein Memleak in readline, wenn der Text beim
        Vervollstaendigen nicht in den Puffer passt.

Signed-off-by: Antoine Kaufmann <toni@xxxxxxxxxx>
---
 src/modules/lib/readline.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/modules/lib/readline.c b/src/modules/lib/readline.c
index 1797041..6f9448d 100644
--- a/src/modules/lib/readline.c
+++ b/src/modules/lib/readline.c
@@ -333,7 +333,7 @@ static bool complete_word(wchar_t* buffer, int* pos, int* len)
 
     // Pruefen ob das ganze nachher noch in den Puffer passt
     if (*len + wrepl_len + 1 > BUFFER_SIZE) {
-        return matches_list_displayed;
+        goto out;
     }
 
     // Text, der dem zu ersetzenden Wort folgt nach hinten schieben
@@ -347,6 +347,7 @@ static bool complete_word(wchar_t* buffer, int* pos, int* len)
     *pos = word_pos + wrepl_len;
     *len = *len + wrepl_len - word_len ;
 
+out:
     free_matches_array(matches);
 
     return matches_list_displayed;
-- 
1.6.0.6