@@ -528,13 +528,11 @@ PHP_FUNCTION(mysqli_execute_query)
528
528
RETURN_FALSE ;
529
529
}
530
530
531
- /* The bit below, which is copied from mysqli_stmt_prepare , is needed for bad index exceptions */
531
+ /* The bit below, which is copied from mysqli_prepare , is needed for bad index exceptions */
532
532
/* don't initialize stmt->query with NULL, we ecalloc()-ed the memory */
533
533
/* Get performance boost if reporting is switched off */
534
534
if (query_len && (MyG (report_mode ) & MYSQLI_REPORT_INDEX )) {
535
- stmt -> query = (char * )emalloc (query_len + 1 );
536
- memcpy (stmt -> query , query , query_len );
537
- stmt -> query [query_len ] = '\0' ;
535
+ stmt -> query = estrdup (query );
538
536
}
539
537
540
538
// bind-in-execute
@@ -1330,9 +1328,7 @@ PHP_FUNCTION(mysqli_prepare)
1330
1328
/* don't initialize stmt->query with NULL, we ecalloc()-ed the memory */
1331
1329
/* Get performance boost if reporting is switched off */
1332
1330
if (stmt -> stmt && query_len && (MyG (report_mode ) & MYSQLI_REPORT_INDEX )) {
1333
- stmt -> query = (char * )emalloc (query_len + 1 );
1334
- memcpy (stmt -> query , query , query_len );
1335
- stmt -> query [query_len ] = '\0' ;
1331
+ stmt -> query = estrdup (query );
1336
1332
}
1337
1333
1338
1334
/* don't join to the previous if because it won't work if mysql_stmt_prepare_fails */
0 commit comments