Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libedit OpenBSD tokenizer.c rev. 1.8 2003/08/11 18:21:40...



details:   https://anonhg.NetBSD.org/src/rev/9835bfe691fd
branches:  trunk
changeset: 813722:9835bfe691fd
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Feb 15 15:37:20 2016 +0000

description:
OpenBSD tokenizer.c rev. 1.8 2003/08/11 18:21:40 deraadt
don't increase amax on realloc failure

diffstat:

 lib/libedit/tokenizer.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 7b421b66fff5 -r 9835bfe691fd lib/libedit/tokenizer.c
--- a/lib/libedit/tokenizer.c   Mon Feb 15 15:35:03 2016 +0000
+++ b/lib/libedit/tokenizer.c   Mon Feb 15 15:37:20 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tokenizer.c,v 1.22 2016/01/30 04:02:51 christos Exp $  */
+/*     $NetBSD: tokenizer.c,v 1.23 2016/02/15 15:37:20 christos Exp $  */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)tokenizer.c        8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tokenizer.c,v 1.22 2016/01/30 04:02:51 christos Exp $");
+__RCSID("$NetBSD: tokenizer.c,v 1.23 2016/02/15 15:37:20 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -413,8 +413,10 @@
                        Char **p;
                        tok->amax += AINCR;
                        p = tok_realloc(tok->argv, tok->amax * sizeof(*p));
-                       if (p == NULL)
+                       if (p == NULL) {
+                               tok->amax -= AINCR;
                                return -1;
+                       }
                        tok->argv = p;
                }
        }



Home | Main Index | Thread Index | Old Index