summaryrefslogtreecommitdiff
path: root/ext/Hash/Util/FieldHash
diff options
context:
space:
mode:
authorAnno Siegel <anno4000@lublin.zrz.tu-berlin.de>2006-07-12 02:45:44 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-07-12 09:00:01 +0000
commit91dba0be91f1c35e9474de79c0592c0c8d8379dc (patch)
tree2c180a7d88610c37778380209a18c671cad4f2aa /ext/Hash/Util/FieldHash
parentc47834cd2409d3680cf65095db9f9ea634e47197 (diff)
downloadperl-91dba0be91f1c35e9474de79c0592c0c8d8379dc.tar.gz
Re: [PATCH] FieldHash coverity-compliant
Message-Id: <7AEBF247-0AF7-46A8-9D61-D38B45FD21EA@mailbox.tu-berlin.de> p4raw-id: //depot/perl@28552
Diffstat (limited to 'ext/Hash/Util/FieldHash')
-rw-r--r--ext/Hash/Util/FieldHash/FieldHash.xs19
1 files changed, 14 insertions, 5 deletions
diff --git a/ext/Hash/Util/FieldHash/FieldHash.xs b/ext/Hash/Util/FieldHash/FieldHash.xs
index 91107ddd8d..faddb96f1c 100644
--- a/ext/Hash/Util/FieldHash/FieldHash.xs
+++ b/ext/Hash/Util/FieldHash/FieldHash.xs
@@ -20,14 +20,23 @@ START_MY_CXT
/* Inquire the object registry (a lexical hash) from perl */
HV* HUF_get_ob_reg(void) {
dSP;
+ HV* ob_reg = NULL;
+ ENTER;
+ SAVETMPS;
+
+ PUSHMARK(SP);
I32 items = call_pv(HUF_OB_REG, G_SCALAR|G_NOARGS);
SPAGAIN;
- if (items == 1) {
- SV* ref = POPs;
- PUTBACK;
- if (ref && SvROK(ref) && SvTYPE(SvRV(ref)) == SVt_PVHV)
- return (HV*)SvRV(ref);
+
+ if (items == 1 && TOPs && SvROK(TOPs) && SvTYPE(SvRV(TOPs)) == SVt_PVHV) {
+ ob_reg = (HV*)SvRV(POPs);
}
+ PUTBACK;
+ FREETMPS;
+ LEAVE;
+
+ if (ob_reg)
+ return ob_reg;
Perl_die(aTHX_ "Can't get object registry hash");
}