changeset 16015:d910b9211cca

Plug memory leak in kbhit(). * libinterp/interpfcn/sysdep.cc(Fkbhit): Don't use new to get 2 bytes of storage. Use a local variable instead.
author Rik <rik@octave.org>
date Thu, 07 Feb 2013 16:46:01 -0800
parents 980f79a7bb55
children 9194bb707d63
files libinterp/interpfcn/sysdep.cc
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/interpfcn/sysdep.cc	Thu Feb 07 15:35:08 2013 -0800
+++ b/libinterp/interpfcn/sysdep.cc	Thu Feb 07 16:46:01 2013 -0800
@@ -653,9 +653,8 @@
       if (c == -1)
         c = 0;
 
-      char *s = new char [2];
-      s[0] = c;
-      s[1] = '\0';
+      char s[2] = {c, '\0'};
+
       retval = s;
     }