Add assertions to cover cases where the Coverity scanner thinks we
authorNicholas Clark <nick@ccl4.org>
Mon, 17 Apr 2006 13:14:55 +0000 (13:14 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 17 Apr 2006 13:14:55 +0000 (13:14 +0000)
could are deferencing a NULL pointer, but we think it missed something
it should have been capable of figuring out.

p4raw-id: //depot/perl@27867

hv.c
op.c

diff --git a/hv.c b/hv.c
index cb36c2f..d912ccd 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -72,6 +72,7 @@ S_new_he(pTHX)
     if (!*root)
        S_more_he(aTHX);
     he = *root;
+    assert(he);
     *root = HeNEXT(he);
     UNLOCK_SV_MUTEX;
     return he;
diff --git a/op.c b/op.c
index 4b73d3f..57e4a1b 100644 (file)
--- a/op.c
+++ b/op.c
@@ -4384,7 +4384,9 @@ whileline, OP *expr, OP *block, OP *cont, I32 has_my)
        cont = append_elem(OP_LINESEQ, cont, unstack);
     }
 
+    assert(block);
     listop = append_list(OP_LINESEQ, (LISTOP*)block, (LISTOP*)cont);
+    assert(listop);
     redo = LINKLIST(listop);
 
     if (expr) {
@@ -7171,6 +7173,7 @@ Perl_ck_split(pTHX_ OP *o)
 
     if (!kid->op_sibling)
        append_elem(OP_SPLIT, o, newSVOP(OP_CONST, 0, newSViv(0)));
+    assert(kid->op_sibling);
 
     kid = kid->op_sibling;
     scalar(kid);