Skip to content

Commit a4ef64d

Browse files
committed
fix: free SpringSourceRowBuilder inside spring_source_row_build()
1 parent 2e2d55d commit a4ef64d

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

springql.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ enum SpringErrno spring_source_row_add_column_blob(SpringSourceRowBuilder *build
232232
/**
233233
* Finish creating a source row using a builder.
234234
*
235+
* The heap space for the `builder` is internally freed.
236+
*
235237
* # Returns
236238
*
237239
* SpringSourceRow

src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ pub unsafe extern "C" fn spring_source_row_add_column_blob(
305305
}
306306
/// Finish creating a source row using a builder.
307307
///
308+
/// The heap space for the `builder` is internally freed.
309+
///
308310
/// # Returns
309311
///
310312
/// SpringSourceRow
@@ -313,7 +315,9 @@ pub unsafe extern "C" fn spring_source_row_build(
313315
builder: *mut SpringSourceRowBuilder,
314316
) -> *mut SpringSourceRow {
315317
let rust_builder = (*builder).to_row_builder();
316-
SpringSourceRow::new(rust_builder.build()).into_ptr()
318+
let ret = SpringSourceRow::new(rust_builder.build()).into_ptr();
319+
SpringSourceRowBuilder::drop(builder);
320+
ret
317321
}
318322

319323
/// Frees heap occupied by a `SpringSourceRow`.

0 commit comments

Comments
 (0)