@@ -139,12 +139,11 @@ export abstract class DuckDBBindingsBase implements DuckDBBindings {
139
139
const bufferOfs = this . mod . HEAPU8 . subarray ( bufferPtr , bufferPtr + BUF . length ) ;
140
140
bufferOfs . set ( BUF ) ;
141
141
const [ s , d , n ] = callSRet ( this . mod , 'duckdb_web_tokenize_buffer' , [ 'number' , 'number' ] , [ bufferPtr , BUF . length ] ) ;
142
+ this . mod . _free ( bufferPtr ) ;
142
143
if ( s !== StatusCode . SUCCESS ) {
143
- this . mod . _free ( bufferPtr ) ;
144
144
throw new Error ( readString ( this . mod , d , n ) ) ;
145
145
}
146
146
const res = readString ( this . mod , d , n ) ;
147
- this . mod . _free ( bufferPtr ) ;
148
147
dropResponseBuffers ( this . mod ) ;
149
148
return JSON . parse ( res ) as ScriptTokens ;
150
149
}
@@ -174,13 +173,12 @@ export abstract class DuckDBBindingsBase implements DuckDBBindings {
174
173
const bufferOfs = this . mod . HEAPU8 . subarray ( bufferPtr , bufferPtr + BUF . length ) ;
175
174
bufferOfs . set ( BUF ) ;
176
175
const [ s , d , n ] = callSRet ( this . mod , 'duckdb_web_query_run_buffer' , [ 'number' , 'number' , 'number' ] , [ conn , bufferPtr , BUF . length ] ) ;
176
+ this . mod . _free ( bufferPtr ) ;
177
177
if ( s !== StatusCode . SUCCESS ) {
178
- this . mod . _free ( bufferPtr ) ;
179
178
throw new Error ( readString ( this . mod , d , n ) ) ;
180
179
}
181
180
const res = copyBuffer ( this . mod , d , n ) ;
182
181
dropResponseBuffers ( this . mod ) ;
183
- this . mod . _free ( bufferPtr ) ;
184
182
return res ;
185
183
}
186
184
/**
@@ -195,16 +193,14 @@ export abstract class DuckDBBindingsBase implements DuckDBBindings {
195
193
const bufferOfs = this . mod . HEAPU8 . subarray ( bufferPtr , bufferPtr + BUF . length ) ;
196
194
bufferOfs . set ( BUF ) ;
197
195
const [ s , d , n ] = callSRet ( this . mod , 'duckdb_web_pending_query_start_buffer' , [ 'number' , 'number' , 'number' , 'boolean' ] , [ conn , bufferPtr , BUF . length , allowStreamResult ] ) ;
196
+ this . mod . _free ( bufferPtr ) ;
198
197
if ( s !== StatusCode . SUCCESS ) {
199
- this . mod . _free ( bufferPtr ) ;
200
198
throw new Error ( readString ( this . mod , d , n ) ) ;
201
199
}
202
200
if ( d == 0 ) {
203
- this . mod . _free ( bufferPtr ) ;
204
201
return null ;
205
202
}
206
203
const res = copyBuffer ( this . mod , d , n ) ;
207
- this . mod . _free ( bufferPtr ) ;
208
204
dropResponseBuffers ( this . mod ) ;
209
205
return res ;
210
206
}
0 commit comments