From: Nicholas Clark Date: Sat, 15 Apr 2006 20:55:20 +0000 (+0000) Subject: Coverity correctly reports that gv might (just) be NULL. So don't X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=71cd1c3f4e2173121a6276de584bf61b847fd780;p=p5sagit%2Fp5-mst-13.2.git Coverity correctly reports that gv might (just) be NULL. So don't derefernece it if it is. p4raw-id: //depot/perl@27823 --- diff --git a/ext/IO/IO.pm b/ext/IO/IO.pm index c8d06bd..ac06642 100644 --- a/ext/IO/IO.pm +++ b/ext/IO/IO.pm @@ -7,7 +7,7 @@ use Carp; use strict; use warnings; -our $VERSION = "1.23"; +our $VERSION = "1.23_01"; XSLoader::load 'IO', $VERSION; sub import { diff --git a/ext/IO/IO.xs b/ext/IO/IO.xs index 4abc135..4b896a5 100644 --- a/ext/IO/IO.xs +++ b/ext/IO/IO.xs @@ -215,8 +215,9 @@ new_tmpfile(packname = "IO::File") fp = tmpfile(); #endif gv = (GV*)SvREFCNT_inc(newGVgen(packname)); - hv_delete(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv), G_DISCARD); - if (do_open(gv, "+>&", 3, FALSE, 0, 0, fp)) { + if (gv) + hv_delete(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv), G_DISCARD); + if (gv && do_open(gv, "+>&", 3, FALSE, 0, 0, fp)) { ST(0) = sv_2mortal(newRV((SV*)gv)); sv_bless(ST(0), gv_stashpv(packname, TRUE)); SvREFCNT_dec(gv); /* undo increment in newRV() */