Module: kamailio
Branch: master
Commit: 927ddcf084b637385df103fb489d843e0255f4f8
URL:
https://github.com/kamailio/kamailio/commit/927ddcf084b637385df103fb489d843…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-06-18T10:00:14+02:00
db_perlvdb: unref in case of error
---
Modified: src/modules/db_perlvdb/perlvdb_conv.c
---
Diff:
https://github.com/kamailio/kamailio/commit/927ddcf084b637385df103fb489d843…
Patch:
https://github.com/kamailio/kamailio/commit/927ddcf084b637385df103fb489d843…
---
diff --git a/src/modules/db_perlvdb/perlvdb_conv.c
b/src/modules/db_perlvdb/perlvdb_conv.c
index 677f09a850..f263774658 100644
--- a/src/modules/db_perlvdb/perlvdb_conv.c
+++ b/src/modules/db_perlvdb/perlvdb_conv.c
@@ -263,9 +263,9 @@ int perlresult2dbres(SV *perlres, db1_res_t **r) {
/* Fetch column definitions */
colarrayref = perlvdb_perlmethod(perlres, PERL_VDB_COLDEFSMETHOD,
NULL, NULL, NULL, NULL);
- if (!(SvROK(colarrayref))) goto error;
+ if (colarrayref==NULL || !(SvROK(colarrayref))) goto error;
colarray = (AV *)SvRV(colarrayref);
- if (!(SvTYPE(colarray) == SVt_PVAV)) goto error;
+ if (colarray==NULL || !(SvTYPE(colarray) == SVt_PVAV)) goto error;
colcount = av_len(colarray) + 1;
@@ -305,7 +305,7 @@ int perlresult2dbres(SV *perlres, db1_res_t **r) {
}
rowarray = (AV *)SvRV(rowarrayref);
- if (!(SvTYPE(rowarray) == SVt_PVAV)) goto error;
+ if (rowarray == NULL || !(SvTYPE(rowarray) == SVt_PVAV)) goto error;
rowcount = av_len(rowarray) + 1;
@@ -403,10 +403,12 @@ int perlresult2dbres(SV *perlres, db1_res_t **r) {
}
end:
- if (colarray) av_undef(colarray);
+ if(colarray) av_undef(colarray);
if (rowarray) av_undef(rowarray);
return retval;
error:
+ if(colarray) av_undef(colarray);
+ if (rowarray) av_undef(rowarray);
LM_CRIT("broken result set. Exiting, leaving Kamailio in unknown state.\n");
return -1;
}