fixing leak
[oweals/gnunet.git] / src / monkey / gdbmi_get_free_vt.c
index f5c980005bf93087e27b70af33ad06d8c31012a4..25e5e75a7f7299727704259031cab9d5a9772564 100644 (file)
@@ -22,7 +22,7 @@ to my needs and changed license from giftware to GPL.@p
 #include <util.h>
 #endif /* __APPLE__ */
 
-#include "mi_gdb.h"
+#include "gdbmi.h"
 
 #if !defined(__linux__)
 
@@ -92,8 +92,10 @@ int mi_look_for_free_vt()
    }
 
  /* Get the state of the console -- in particular, the free VT field */
- if (ioctl(console_fd,VT_GETSTATE,&vts))
+ if (ioctl(console_fd,VT_GETSTATE,&vts)) {
+        close(console_fd);
     return -2;
+ }
  close(console_fd);
 
  /* We attempt to set our euid to 0; if we were run with euid 0 to
@@ -136,6 +138,7 @@ release it.
 
 mi_aux_term *gmi_look_for_free_vt()
 {
+ int ret;
  int vt=mi_look_for_free_vt();
  mi_aux_term *res;
 
@@ -145,7 +148,7 @@ mi_aux_term *gmi_look_for_free_vt()
  if (!res)
     return NULL;
  res->pid=-1;
- asprintf(&res->tty,"/dev/tty%d",vt);
ret = asprintf(&res->tty,"/dev/tty%d",vt);
  return res;
 }