diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-06-24 20:28:37 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-06-24 20:28:37 -0700 |
commit | 692384e883787dd48e412f43b297f0f58d0bddf0 (patch) | |
tree | 4a118c3f15a09eafcffb4a02f2c225eab7a25be6 | |
parent | f1a1e10921fa1ab465e3ea231a47352d43e247aa (diff) | |
download | txr-692384e883787dd48e412f43b297f0f58d0bddf0.tar.gz txr-692384e883787dd48e412f43b297f0f58d0bddf0.tar.bz2 txr-692384e883787dd48e412f43b297f0f58d0bddf0.zip |
ffi: fix memory leak regression.
The recent commit "ffi: elide useless by-value in calls."
neglects to mark a few types with the by_value_in flag.
The string types need it because their in action performs
memory freeing, which must be done regardless of the
by-value or by-pointer semantics.
* ffi.c (ffi_init_types): set by_value_in to 1 for str,
bstr and wstr. In general, if the type needs a release
function, it needs by_value_in to be set.
-rw-r--r-- | ffi.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -3741,6 +3741,7 @@ static void ffi_init_types(void) struct txr_ffi_type *tft = ffi_type_struct(type); tft->in = ffi_str_in; tft->release = ffi_simple_release; + tft->by_value_in = 1; ffi_typedef(str_s, type); } @@ -3752,6 +3753,7 @@ static void ffi_init_types(void) struct txr_ffi_type *tft = ffi_type_struct(type); tft->in = ffi_bstr_in; tft->release = ffi_simple_release; + tft->by_value_in = 1; ffi_typedef(bstr_s, type); } @@ -3769,6 +3771,7 @@ static void ffi_init_types(void) struct txr_ffi_type *tft = ffi_type_struct(type); tft->in = ffi_wstr_in; tft->release = ffi_simple_release; + tft->by_value_in = 1; ffi_typedef(wstr_s, type); } |