Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit put the NULL check immediately after the allocation



details:   https://anonhg.NetBSD.org/src/rev/e978f4ddd559
branches:  trunk
changeset: 462018:e978f4ddd559
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jul 23 10:19:35 2019 +0000

description:
put the NULL check immediately after the allocation

diffstat:

 lib/libedit/hist.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 08b94484e25c -r e978f4ddd559 lib/libedit/hist.c
--- a/lib/libedit/hist.c        Tue Jul 23 10:18:52 2019 +0000
+++ b/lib/libedit/hist.c        Tue Jul 23 10:19:35 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hist.c,v 1.33 2019/07/23 10:18:52 christos Exp $       */
+/*     $NetBSD: hist.c,v 1.34 2019/07/23 10:19:35 christos Exp $       */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)hist.c     8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: hist.c,v 1.33 2019/07/23 10:18:52 christos Exp $");
+__RCSID("$NetBSD: hist.c,v 1.34 2019/07/23 10:19:35 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -60,9 +60,9 @@
        el->el_history.fun = NULL;
        el->el_history.ref = NULL;
        el->el_history.buf = el_calloc(EL_BUFSIZ, sizeof(*el->el_history.buf));
-       el->el_history.sz  = EL_BUFSIZ;
        if (el->el_history.buf == NULL)
                return -1;
+       el->el_history.sz  = EL_BUFSIZ;
        el->el_history.last = el->el_history.buf;
        return 0;
 }



Home | Main Index | Thread Index | Old Index