diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-04-16 09:36:18 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-04-16 09:36:18 +0000 |
commit | f4a7049d1e66956838433895a259b4fb84d25493 (patch) | |
tree | b34f67bc06756e02d3aab3dcbf073529435bec7d /pp_sys.c | |
parent | 01f6e8062d776f5a635aed599b0634d217fae39b (diff) | |
download | perl-f4a7049d1e66956838433895a259b4fb84d25493.tar.gz |
Coverity notes that we might be dereferencing fgv before a check that
it's not NULL. In fact, the code ordering meant that one "if (fgv)"
would always be true. So fix this.
p4raw-id: //depot/perl@27837
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -1277,16 +1277,17 @@ PP(pp_enterwrite) else fgv = gv; + if (!fgv) { + DIE(aTHX_ "Not a format reference"); + } cv = GvFORM(fgv); if (!cv) { - if (fgv) { - SV * const tmpsv = sv_newmortal(); - const char *name; - gv_efullname4(tmpsv, fgv, NULL, FALSE); - name = SvPV_nolen_const(tmpsv); - if (name && *name) - DIE(aTHX_ "Undefined format \"%s\" called", name); - } + SV * const tmpsv = sv_newmortal(); + const char *name; + gv_efullname4(tmpsv, fgv, NULL, FALSE); + name = SvPV_nolen_const(tmpsv); + if (name && *name) + DIE(aTHX_ "Undefined format \"%s\" called", name); DIE(aTHX_ "Not a format reference"); } if (CvCLONE(cv)) |