Coverity correctly reports that gv might (just) be NULL. So don't
Nicholas Clark [Sat, 15 Apr 2006 20:55:20 +0000 (20:55 +0000)]
derefernece it if it is.

p4raw-id: //depot/perl@27823

ext/IO/IO.pm
ext/IO/IO.xs

index c8d06bd..ac06642 100644 (file)
@@ -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 {
index 4abc135..4b896a5 100644 (file)
@@ -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() */