]> sourceware.org Git - systemtap.git/commitdiff
cmd_file(): only free words if succeeded
authorJonathan Lebon <jlebon@redhat.com>
Thu, 1 May 2014 20:31:59 +0000 (16:31 -0400)
committerJonathan Lebon <jlebon@redhat.com>
Thu, 1 May 2014 20:31:59 +0000 (16:31 -0400)
Otherwise, we may accidentally summon Cthulhu.

session.cxx

index 3b968782cacd69fd5bc7a3e7e9f47019e1737e9c..f457829a6036b21859f91ed154989724eeb85a6d 100644 (file)
@@ -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;
 }
 
This page took 0.296779 seconds and 5 git commands to generate.