@@ -125,7 +125,7 @@ static inline void destroy_user_exception(void *user_exc_)
125
125
{
126
126
user_exception * user_exn = user_exc_ ;
127
127
caml_remove_global_root (& user_exn -> exn );
128
- free (user_exn );
128
+ caml_stat_free (user_exn );
129
129
}
130
130
131
131
static inline void maybe_raise_user_exception (int rc )
@@ -343,11 +343,11 @@ static inline void ref_count_finalize_dbw(db_wrap *dbw)
343
343
user_function * link ;
344
344
for (link = dbw -> user_functions ; link != NULL ; link = link -> next ) {
345
345
caml_remove_generational_global_root (& link -> v_fun );
346
- free (link );
346
+ caml_stat_free (link );
347
347
}
348
348
dbw -> user_functions = NULL ;
349
349
sqlite3_close (dbw -> db );
350
- free (dbw );
350
+ caml_stat_free (dbw );
351
351
}
352
352
}
353
353
@@ -419,11 +419,11 @@ CAMLprim value caml_sqlite3_open(
419
419
caml_enter_blocking_section ();
420
420
#ifdef SQLITE_HAS_OPEN_V2
421
421
res = sqlite3_open_v2 (file , & db , flags , vfs );
422
- free (vfs );
422
+ caml_stat_free (vfs );
423
423
#else
424
424
res = sqlite3_open (file , & db );
425
425
#endif
426
- free (file );
426
+ caml_stat_free (file );
427
427
caml_leave_blocking_section ();
428
428
429
429
if (res ) {
@@ -559,7 +559,7 @@ CAMLprim value caml_sqlite3_exec(value v_db, value v_maybe_cb, value v_sql)
559
559
560
560
caml_enter_blocking_section ();
561
561
rc = sqlite3_exec (dbw -> db , sql , cb , (void * ) & cbx , NULL );
562
- free (sql );
562
+ caml_stat_free (sql );
563
563
caml_leave_blocking_section ();
564
564
565
565
if (rc == SQLITE_ABORT ) caml_raise (* cbx .exn );
@@ -609,7 +609,7 @@ CAMLprim value caml_sqlite3_exec_no_headers(value v_db, value v_cb, value v_sql)
609
609
caml_enter_blocking_section ();
610
610
rc =
611
611
sqlite3_exec (dbw -> db , sql , exec_callback_no_headers , (void * ) & cbx , NULL );
612
- free (sql );
612
+ caml_stat_free (sql );
613
613
caml_leave_blocking_section ();
614
614
615
615
if (rc == SQLITE_ABORT ) caml_raise (* cbx .exn );
@@ -670,7 +670,7 @@ CAMLprim value caml_sqlite3_exec_not_null(value v_db, value v_cb, value v_sql)
670
670
caml_enter_blocking_section ();
671
671
rc =
672
672
sqlite3_exec (dbw -> db , sql , exec_not_null_callback , (void * ) & cbx , NULL );
673
- free (sql );
673
+ caml_stat_free (sql );
674
674
caml_leave_blocking_section ();
675
675
676
676
if (rc == SQLITE_ABORT ) {
@@ -731,7 +731,7 @@ CAMLprim value caml_sqlite3_exec_not_null_no_headers(
731
731
rc =
732
732
sqlite3_exec (
733
733
dbw -> db , sql , exec_not_null_no_headers_callback , (void * ) & cbx , NULL );
734
- free (sql );
734
+ caml_stat_free (sql );
735
735
caml_leave_blocking_section ();
736
736
737
737
if (rc == SQLITE_ABORT ) {
@@ -751,9 +751,9 @@ static inline void finalize_stmt_gc(value v_stmt)
751
751
stmt_wrap * stmtw = Sqlite3_stmtw_val (v_stmt );
752
752
sqlite3_stmt * stmt = stmtw -> stmt ;
753
753
if (stmt ) sqlite3_finalize (stmt );
754
- if (stmtw -> sql ) free (stmtw -> sql );
754
+ if (stmtw -> sql ) caml_stat_free (stmtw -> sql );
755
755
ref_count_finalize_dbw (stmtw -> db_wrap );
756
- free (stmtw );
756
+ caml_stat_free (stmtw );
757
757
}
758
758
759
759
CAMLprim value caml_sqlite3_stmt_finalize (value v_stmt )
@@ -1137,7 +1137,7 @@ static inline void unregister_user_function(db_wrap *db_data, value v_name)
1137
1137
if (prev == NULL ) db_data -> user_functions = link -> next ;
1138
1138
else prev -> next = link -> next ;
1139
1139
caml_remove_generational_global_root (& link -> v_fun );
1140
- free (link );
1140
+ caml_stat_free (link );
1141
1141
break ;
1142
1142
}
1143
1143
prev = link ;
@@ -1257,4 +1257,3 @@ CAMLprim value caml_sqlite3_changes(value v_db)
1257
1257
check_db (dbw , "changes" );
1258
1258
return Val_int (sqlite3_changes (dbw -> db ));
1259
1259
}
1260
-
0 commit comments