Skip to content

Commit

Permalink
Possible NULL cxt derefs.
Browse files Browse the repository at this point in the history
Coverity CIDs 104819, 104820, 104821, 104827, 104859, 104860

Using assert() instead of Storable ASSERT() because Coverity
understands the first one.
  • Loading branch information
jhi committed Jun 27, 2015
1 parent db1d297 commit 61f2771
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dist/Storable/Storable.xs
Expand Up @@ -1716,6 +1716,7 @@ static int last_op_in_netorder(pTHX)
{
dSTCXT;

assert(cxt);
return cxt->netorder;
}

Expand Down Expand Up @@ -3845,6 +3846,7 @@ static int do_store(
* free up memory for them now.
*/

assert(cxt);
if (cxt->s_dirty)
clean_context(aTHX_ cxt);

Expand Down Expand Up @@ -3946,6 +3948,7 @@ static SV *mbuf2sv(pTHX)
{
dSTCXT;

assert(cxt);
return newSVpv(mbase, MBUF_SIZE());
}

Expand Down Expand Up @@ -6263,6 +6266,7 @@ static SV *do_retrieve(
* free up memory for them now.
*/

assert(cxt);
if (cxt->s_dirty)
clean_context(aTHX_ cxt);

Expand Down Expand Up @@ -6509,6 +6513,7 @@ static SV *dclone(pTHX_ SV *sv)
* free up memory for them now.
*/

assert(cxt);
if (cxt->s_dirty)
clean_context(aTHX_ cxt);

Expand Down Expand Up @@ -6546,6 +6551,7 @@ static SV *dclone(pTHX_ SV *sv)
* Now, 'cxt' may refer to a new context.
*/

assert(cxt);
ASSERT(!cxt->s_dirty, ("clean context"));
ASSERT(!cxt->entry, ("entry will not cause new context allocation"));

Expand Down Expand Up @@ -6708,6 +6714,7 @@ last_op_in_netorder()
if (ix) {
dSTCXT;

assert(cxt);
result = cxt->entry && (cxt->optype & ix) ? TRUE : FALSE;
} else {
result = !!last_op_in_netorder(aTHX);
Expand Down

0 comments on commit 61f2771

Please sign in to comment.