about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorDmitry Podgorny <pasis.ua@gmail.com>2020-10-09 13:39:52 +0300
committerDmitry Podgorny <pasis.ua@gmail.com>2020-10-09 13:39:52 +0300
commit64df8630d4c9631625bccba8ffcdcbd05967e2cc (patch)
treeb65100023b143ecbbc2f31750067cb586af1dd67 /src
parenta80b5603a4747d508997c03b485c0d3877fc64ce (diff)
downloadprofani-tty-64df8630d4c9631625bccba8ffcdcbd05967e2cc.tar.gz
Fix use-after-free which is introduced in cons_alert()
Commit f12161f fixes memory leak, but introduces use-after-free issue.
Allocate new memory for win_name with g_strdup() since it is freed with
g_free() later.
Diffstat (limited to 'src')
-rw-r--r--src/ui/console.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ui/console.c b/src/ui/console.c
index 8e06b290..a3797963 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -2408,7 +2408,7 @@ cons_alert(ProfWin* alert_origin_window)
 
         GList* item = g_list_find_custom(alert_list, win_name, (GCompareFunc)g_strcmp0);
         if (!item) {
-            alert_list = g_list_append(alert_list, win_name);
+            alert_list = g_list_append(alert_list, g_strdup(win_name));
         }
 
         free(win_name);