diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e5c8f6..4858888 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ Also check the changes in springql-core: ## [Unreleased] +## [v0.16.0+3] - 2022-07-11 + +### Fixed + +- Memory leak of `SpringSourceRowBuilder` ([#58](https://github.com/SpringQL/SpringQL-client-c/pull/58)) + ## [v0.16.0+2] - 2022-07-06 ### Added @@ -118,8 +124,9 @@ Depends on springql-core v0.7.1. [Semantic Versioning]: https://semver.org/ -[Unreleased]: https://github.com/SpringQL/SpringQL-client-c/compare/v0.16.0+2...HEAD +[Unreleased]: https://github.com/SpringQL/SpringQL-client-c/compare/v0.16.0+3...HEAD [Released]: https://github.com/SpringQL/SpringQL-client-c/releases +[v0.16.0+3]: https://github.com/SpringQL/SpringQL-client-c/compare/v0.16.0+2...v0.16.0+3 [v0.16.0+2]: https://github.com/SpringQL/SpringQL-client-c/compare/v0.16.0...v0.16.0+2 [v0.16.0]: https://github.com/SpringQL/SpringQL-client-c/compare/v0.15.0+2...v0.16.0 [v0.15.0+2]: https://github.com/SpringQL/SpringQL-client-c/compare/v0.15.0...v0.15.0+2 diff --git a/springql.h b/springql.h index 8762090..f35e43d 100644 --- a/springql.h +++ b/springql.h @@ -232,6 +232,8 @@ enum SpringErrno spring_source_row_add_column_blob(SpringSourceRowBuilder *build /** * Finish creating a source row using a builder. * + * The heap space for the `builder` is internally freed. + * * # Returns * * SpringSourceRow diff --git a/src/lib.rs b/src/lib.rs index e76f2d8..d708867 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -305,6 +305,8 @@ pub unsafe extern "C" fn spring_source_row_add_column_blob( } /// Finish creating a source row using a builder. /// +/// The heap space for the `builder` is internally freed. +/// /// # Returns /// /// SpringSourceRow @@ -313,7 +315,9 @@ pub unsafe extern "C" fn spring_source_row_build( builder: *mut SpringSourceRowBuilder, ) -> *mut SpringSourceRow { let rust_builder = (*builder).to_row_builder(); - SpringSourceRow::new(rust_builder.build()).into_ptr() + let ret = SpringSourceRow::new(rust_builder.build()).into_ptr(); + SpringSourceRowBuilder::drop(builder); + ret } /// Frees heap occupied by a `SpringSourceRow`.