From: Ruben Kerkhof Date: Fri, 4 Dec 2015 20:30:14 +0000 (+0100) Subject: perl: Check for NULL before dereferencing X-Git-Tag: collectd-5.5.1~31^2~5 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=84c3e994c70aebb5ed1882a1f9cb2bfa6f64d39d;p=collectd.git perl: Check for NULL before dereferencing CID #38023 Signed-off-by: Florian Forster --- diff --git a/src/perl.c b/src/perl.c index 5aa96c35..67cb842b 100644 --- a/src/perl.c +++ b/src/perl.c @@ -1643,15 +1643,15 @@ static XS (Collectd_plugin_dispatch_values) values = ST (/* stack index = */ 0); + if (NULL == values) + XSRETURN_EMPTY; + /* Make sure the argument is a hash reference. */ if (! (SvROK (values) && (SVt_PVHV == SvTYPE (SvRV (values))))) { log_err ("Collectd::plugin_dispatch_values: Invalid values."); XSRETURN_EMPTY; } - if (NULL == values) - XSRETURN_EMPTY; - ret = pplugin_dispatch_values (aTHX_ (HV *)SvRV (values)); if (0 == ret)