@@ -71,7 +71,6 @@ struct placeholder {
71
71
const char *pos;
72
72
size_t len;
73
73
zend_string *quoted; /* quoted value */
74
- int freeq;
75
74
int bindno;
76
75
struct placeholder *next;
77
76
};
@@ -123,7 +122,6 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, zend_string *inquery, zend_string
123
122
if (t == PDO_PARSER_ESCAPED_QUESTION) {
124
123
plc->bindno = PDO_PARSER_BINDNO_ESCAPED_CHAR;
125
124
plc->quoted = ZSTR_CHAR (' ?' );
126
- plc->freeq = 0 ;
127
125
escapes++;
128
126
} else {
129
127
plc->bindno = bindno++;
@@ -240,7 +238,6 @@ safe:
240
238
}
241
239
242
240
plc->quoted = stmt->dbh ->methods ->quoter (stmt->dbh , buf, param->param_type );
243
- plc->freeq = 1 ;
244
241
245
242
if (buf) {
246
243
zend_string_release_ex (buf, 0 );
@@ -262,17 +259,14 @@ safe:
262
259
switch (param_type) {
263
260
case PDO_PARAM_BOOL:
264
261
plc->quoted = zend_is_true (parameter) ? ZSTR_CHAR (' 1' ) : ZSTR_CHAR (' 0' );
265
- plc->freeq = 0 ;
266
262
break ;
267
263
268
264
case PDO_PARAM_INT:
269
265
plc->quoted = zend_long_to_str (zval_get_long (parameter));
270
- plc->freeq = 1 ;
271
266
break ;
272
267
273
268
case PDO_PARAM_NULL:
274
269
plc->quoted = ZSTR_KNOWN (ZEND_STR_NULL);
275
- plc->freeq = 0 ;
276
270
break ;
277
271
278
272
default : {
@@ -286,7 +280,6 @@ safe:
286
280
}
287
281
288
282
plc->quoted = stmt->dbh ->methods ->quoter (stmt->dbh , buf, param_type);
289
- plc->freeq = 1 ;
290
283
}
291
284
}
292
285
@@ -301,7 +294,7 @@ safe:
301
294
} else {
302
295
parameter = ¶m->parameter ;
303
296
}
304
- plc->quoted = Z_STR_P (parameter);
297
+ plc->quoted = zend_string_copy ( Z_STR_P (parameter) );
305
298
}
306
299
newbuffer_len += ZSTR_LEN (plc->quoted );
307
300
}
@@ -377,7 +370,6 @@ rewrite:
377
370
}
378
371
379
372
plc->quoted = idxbuf;
380
- plc->freeq = 1 ;
381
373
newbuffer_len += ZSTR_LEN (plc->quoted );
382
374
383
375
if (!skip_map && stmt->named_rewrite_template ) {
@@ -420,11 +412,9 @@ clean_up:
420
412
while (placeholders) {
421
413
plc = placeholders;
422
414
placeholders = plc->next ;
423
-
424
- if (plc->freeq ) {
415
+ if (plc->quoted ) {
425
416
zend_string_release_ex (plc->quoted , 0 );
426
417
}
427
-
428
418
efree (plc);
429
419
}
430
420
0 commit comments