poke-devel
[Top][All Lists]
Advanced

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

[PATCH 2/5] Fix memory leak of char* poke_history


From: Dan Čermák
Subject: [PATCH 2/5] Fix memory leak of char* poke_history
Date: Tue, 17 Dec 2019 00:45:00 +0100

From: Dan Čermák <address@hidden>

This variable holds the filename of the poke history file, it is allocated via
xmalloc, but never freed.
---
 src/pk-repl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/pk-repl.c b/src/pk-repl.c
index 4c60d3f..da807e0 100644
--- a/src/pk-repl.c
+++ b/src/pk-repl.c
@@ -196,8 +196,10 @@ pk_repl (void)
       free (line);
     }
 #if defined HAVE_READLINE_HISTORY_H
-  if (poke_history)
-    write_history (poke_history);
+  if (poke_history) {
+    write_history(poke_history);
+    free(poke_history);
+  }
 #endif
 }
 
-- 
2.23.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]