Skip to content

Commit 8d15cdb

Browse files
committed
Allocate and free memory properly
1 parent 3bf28c7 commit 8d15cdb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

ext/pdo_firebird/firebird_driver.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -492,15 +492,15 @@ static void firebird_handle_closer(pdo_dbh_t *dbh) /* {{{ */
492492
}
493493

494494
if (H->date_format) {
495-
efree(H->date_format);
495+
pefree(H->date_format, dbh->is_persistent);
496496
H->date_format = NULL;
497497
}
498498
if (H->time_format) {
499-
efree(H->time_format);
499+
pefree(H->time_format, dbh->is_persistent);
500500
H->time_format = NULL;
501501
}
502502
if (H->timestamp_format) {
503-
efree(H->timestamp_format);
503+
pefree(H->timestamp_format, dbh->is_persistent);
504504
H->timestamp_format = NULL;
505505
}
506506

@@ -884,10 +884,10 @@ static bool firebird_handle_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *
884884
return false;
885885
}
886886
if (H->date_format) {
887-
efree(H->date_format);
887+
pefree(H->date_format, dbh->is_persistent);
888888
H->date_format = NULL;
889889
}
890-
spprintf(&H->date_format, 0, "%s", ZSTR_VAL(str));
890+
H->date_format = pestrdup(ZSTR_VAL(str), dbh->is_persistent);
891891
zend_string_release_ex(str, 0);
892892
}
893893
return true;
@@ -899,10 +899,10 @@ static bool firebird_handle_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *
899899
return false;
900900
}
901901
if (H->time_format) {
902-
efree(H->time_format);
902+
pefree(H->time_format, dbh->is_persistent);
903903
H->time_format = NULL;
904904
}
905-
spprintf(&H->time_format, 0, "%s", ZSTR_VAL(str));
905+
H->time_format = pestrdup(ZSTR_VAL(str), dbh->is_persistent);
906906
zend_string_release_ex(str, 0);
907907
}
908908
return true;
@@ -914,10 +914,10 @@ static bool firebird_handle_set_attribute(pdo_dbh_t *dbh, zend_long attr, zval *
914914
return false;
915915
}
916916
if (H->timestamp_format) {
917-
efree(H->timestamp_format);
917+
pefree(H->timestamp_format, dbh->is_persistent);
918918
H->timestamp_format = NULL;
919919
}
920-
spprintf(&H->timestamp_format, 0, "%s", ZSTR_VAL(str));
920+
H->timestamp_format = pestrdup(ZSTR_VAL(str), dbh->is_persistent);
921921
zend_string_release_ex(str, 0);
922922
}
923923
return true;

0 commit comments

Comments
 (0)