]> granicus.if.org Git - sudo/commitdiff
Regen with yacc that has a memory leak plugged.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 26 Jan 2000 23:14:18 +0000 (23:14 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 26 Jan 2000 23:14:18 +0000 (23:14 +0000)
sudo.tab.c

index 266b475e6a495d5839824b75bc6313101ae208b0..75732a05bec1d1560a6b51ae1bd8847aa5cd2450 100644 (file)
@@ -4,7 +4,7 @@ static char yyrcsid[]
 #if __GNUC__ == 2
   __attribute__ ((unused))
 #endif /* __GNUC__ == 2 */
-  = "$OpenBSD: skeleton.c,v 1.13 1998/11/18 15:45:12 dm Exp $";
+  = "$OpenBSD: skeleton.c,v 1.14 2000/01/26 22:37:24 deraadt Exp $";
 #endif
 #include <stdlib.h>
 #define YYBYACC 1
@@ -18,7 +18,7 @@ static char yyrcsid[]
 #define YYPREFIX "yy"
 #line 2 "parse.yacc"
 /*
- * Copyright (c) 1996, 1998, 1999 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 1996, 1998-2000 Todd C. Miller <Todd.Miller@courtesan.com>
  * All rights reserved.
  *
  * This code is derived from software contributed by Chris Jepeway
@@ -950,18 +950,26 @@ static int yygrowstack()
     newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
       (short *)malloc(newsize * sizeof *newss);
     if (newss == NULL)
-        return -1;
+        goto bail;
     yyss = newss;
     yyssp = newss + i;
     newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
       (YYSTYPE *)malloc(newsize * sizeof *newvs);
     if (newvs == NULL)
-        return -1;
+        goto bail;
     yyvs = newvs;
     yyvsp = newvs + i;
     yystacksize = newsize;
     yysslim = yyss + newsize - 1;
     return 0;
+bail:
+    if (yyss)
+            free(yyss);
+    if (yyvs)
+            free(yyvs);
+    yyss = yyssp = yyvs = yyvsp = NULL;
+    yystacksize = 0;
+    return -1;
 }
 
 #define YYABORT goto yyabort
@@ -1793,7 +1801,7 @@ case 86:
                            yyval.BOOLEAN = TRUE;
                        }
 break;
-#line 1797 "sudo.tab.c"
+#line 1805 "sudo.tab.c"
     }
     yyssp -= yym;
     yystate = *yyssp;