mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 06:08:38 -04:00
Use av_fetch instead of av_shift, to avoid leaks
This commit is contained in:
parent
c5cce9f54f
commit
dd6ab32da9
2 changed files with 6 additions and 2 deletions
1
Changes
1
Changes
|
@ -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
|
||||
|
|
7
dbdimp.c
7
dbdimp.c
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue