Skip to content

Commit 1b31a76

Browse files
nikicGirgias
authored andcommitted
Remove freeq member
1 parent 848f7e0 commit 1b31a76

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

ext/pdo/pdo_sql_parser.re

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ struct placeholder {
7171
const char *pos;
7272
size_t len;
7373
zend_string *quoted; /* quoted value */
74-
int freeq;
7574
int bindno;
7675
struct placeholder *next;
7776
};
@@ -123,7 +122,6 @@ PDO_API int pdo_parse_params(pdo_stmt_t *stmt, zend_string *inquery, zend_string
123122
if (t == PDO_PARSER_ESCAPED_QUESTION) {
124123
plc->bindno = PDO_PARSER_BINDNO_ESCAPED_CHAR;
125124
plc->quoted = ZSTR_CHAR('?');
126-
plc->freeq = 0;
127125
escapes++;
128126
} else {
129127
plc->bindno = bindno++;
@@ -240,7 +238,6 @@ safe:
240238
}
241239

242240
plc->quoted = stmt->dbh->methods->quoter(stmt->dbh, buf, param->param_type);
243-
plc->freeq = 1;
244241

245242
if (buf) {
246243
zend_string_release_ex(buf, 0);
@@ -262,17 +259,14 @@ safe:
262259
switch (param_type) {
263260
case PDO_PARAM_BOOL:
264261
plc->quoted = zend_is_true(parameter) ? ZSTR_CHAR('1') : ZSTR_CHAR('0');
265-
plc->freeq = 0;
266262
break;
267263

268264
case PDO_PARAM_INT:
269265
plc->quoted = zend_long_to_str(zval_get_long(parameter));
270-
plc->freeq = 1;
271266
break;
272267

273268
case PDO_PARAM_NULL:
274269
plc->quoted = ZSTR_KNOWN(ZEND_STR_NULL);
275-
plc->freeq = 0;
276270
break;
277271

278272
default: {
@@ -286,7 +280,6 @@ safe:
286280
}
287281

288282
plc->quoted = stmt->dbh->methods->quoter(stmt->dbh, buf, param_type);
289-
plc->freeq = 1;
290283
}
291284
}
292285

@@ -301,7 +294,7 @@ safe:
301294
} else {
302295
parameter = &param->parameter;
303296
}
304-
plc->quoted = Z_STR_P(parameter);
297+
plc->quoted = zend_string_copy(Z_STR_P(parameter));
305298
}
306299
newbuffer_len += ZSTR_LEN(plc->quoted);
307300
}
@@ -377,7 +370,6 @@ rewrite:
377370
}
378371

379372
plc->quoted = idxbuf;
380-
plc->freeq = 1;
381373
newbuffer_len += ZSTR_LEN(plc->quoted);
382374

383375
if (!skip_map && stmt->named_rewrite_template) {
@@ -420,11 +412,9 @@ clean_up:
420412
while (placeholders) {
421413
plc = placeholders;
422414
placeholders = plc->next;
423-
424-
if (plc->freeq) {
415+
if (plc->quoted) {
425416
zend_string_release_ex(plc->quoted, 0);
426417
}
427-
428418
efree(plc);
429419
}
430420

0 commit comments

Comments
 (0)