Read a borrowed const char * return without freeing it - #14
Merged
estebanzimanyi merged 1 commit intoSep 2, 2026
Merged
Conversation
estebanzimanyi
force-pushed
the
fix/const-char-return
branch
from
September 2, 2026 19:54
84a2322 to
b2e3638
Compare
The Utf8 string marshaller frees the pointer a `char *` return hands back. That is right for a string MEOS mallocs for the caller and fatal for the `const char *` it returns out of a static table: `temporal_interp` answers with an element of `MEOS_INTERPTYPE_NAMES`, and freeing that ends the process — `Test host process crashed : free(): invalid pointer`. The eleven functions whose return is `const char *` — `temporal_interp`, `temporal_subtype`, `temporal_basetype_name`, `meostype_name` and their kin — come back as the pointer itself and are read with `Marshal.PtrToStringUTF8`, which copies and frees nothing. Three tests read an interpolation name: off a linear sequence, off a discrete one, and off two temporal values in turn. They exercise the native library, so the test step takes the LD_LIBRARY_PATH of the prefix the provisioning built, as the smoke step does, and every test class opens a MEOS session of its own: MEOS keeps the timezone its text I/O goes through and the error handler per thread, and the test host runs a test on whichever thread it has free, so a session opened once for the assembly reaches the thread that opened it and no other.
estebanzimanyi
force-pushed
the
fix/const-char-return
branch
from
September 2, 2026 20:00
b2e3638 to
5a785ae
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Utf8 string marshaller frees the pointer a
char *return hands back.That is right for a string MEOS mallocs for the caller and fatal for the
const char *it returns out of a static table:temporal_interpanswerswith an element of
MEOS_INTERPTYPE_NAMES, and freeing that ends theprocess —
Test host process crashed : free(): invalid pointer. Theeleven functions whose return is
const char *—temporal_interp,temporal_subtype,temporal_basetype_name,meostype_nameand theirkin — come back as the pointer itself and are read with
Marshal.PtrToStringUTF8, which copies and frees nothing.Three tests read an interpolation name: off a linear sequence, off a
discrete one, and off two temporal values in turn. They exercise the native
library, so the test step takes the LD_LIBRARY_PATH of the prefix the
provisioning built, as the smoke step does, and every test class opens a
MEOS session of its own: MEOS keeps the timezone its text I/O goes through
and the error handler per thread, and the test host runs a test on
whichever thread it has free, so a session opened once for the assembly
reaches the thread that opened it and no other.