1
0
Fork 0
mirror of https://github.com/DBD-SQLite/DBD-SQLite synced 2025-06-07 14:19:10 -04:00

Use av_fetch instead of av_shift, to avoid leaks

This commit is contained in:
Kenichi Ishigaki 2020-11-23 21:41:57 +09:00
parent c5cce9f54f
commit dd6ab32da9
2 changed files with 6 additions and 2 deletions

View file

@ -3,6 +3,7 @@ Changes for Perl extension DBD-SQLite
1.67_01 to be released
- Switched to XSLoader (GH#63; toddr++)
- Use quadmath_snprintf if USE_QUADMATH is defined
- Use av_fetch instead of av_shift
1.66 2020-08-30
- Switched to a production version

View file

@ -296,6 +296,7 @@ sqlite_set_result(pTHX_ sqlite3_context *context, SV *result, int is_error)
sqlite3_int64 iv;
AV *av;
SV *result2, *type;
SV **presult2, **ptype;
if ( is_error ) {
s = SvPV(result, len);
@ -309,8 +310,10 @@ sqlite_set_result(pTHX_ sqlite3_context *context, SV *result, int is_error)
} else if( SvROK(result) && SvTYPE(SvRV(result)) == SVt_PVAV ) {
av = (AV*)SvRV(result);
if ( av_len(av) == 1 ) {
result2 = av_shift(av);
type = av_shift(av);
presult2 = av_fetch(av, 0, 0);
ptype = av_fetch(av, 1, 0);
result2 = presult2 ? *presult2 : &PL_sv_undef;
type = ptype ? *ptype : &PL_sv_undef;
if ( SvIOK(type) ) {
switch(sqlite_type_from_odbc_type(SvIV(type))) {
case SQLITE_INTEGER: