From 1dfff0a792aa0e750094aa9642ae8f4991e7e292 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Thu, 1 May 2014 16:31:59 -0400 Subject: [PATCH] cmd_file(): only free words if succeeded Otherwise, we may accidentally summon Cthulhu. --- session.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/session.cxx b/session.cxx index 3b968782c..f457829a6 100644 --- a/session.cxx +++ b/session.cxx @@ -1773,8 +1773,10 @@ systemtap_session::cmd_file () int rc = wordexp (cmd.c_str (), &words, WRDE_NOCMD|WRDE_UNDEF); string file; if(rc == 0 && words.we_wordc > 0) - file = words.we_wordv[0]; - wordfree (& words); + { + file = words.we_wordv[0]; + wordfree (& words); + } return file; } -- 2.43.5