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 | a7ffb3583b2f805521372e511bafdce65318903c (patch) | |
tree | 4a118c3f15a09eafcffb4a02f2c225eab7a25be6 | |
parent | 4bc6717ece7f685b8d5da4cf3ace86f45d7c68be (diff) | |
download | txr-a7ffb3583b2f805521372e511bafdce65318903c.tar.gz txr-a7ffb3583b2f805521372e511bafdce65318903c.tar.bz2 txr-a7ffb3583b2f805521372e511bafdce65318903c.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); } |