Skip to content

Commit

Permalink
Merge pull request #18 from grain-lang/fix-safe-string-val
Browse files Browse the repository at this point in the history
Safer Safe_String_val implementation
  • Loading branch information
ospencer authored Jul 21, 2020
2 parents c925d64 + 182e88d commit aca8896
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ocaml_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static struct custom_operations binaryen_ops;
#define Is_none(v) ((v) == Val_none)
#define Is_some(v) Is_block(v)

#define Safe_String_val(v) strdup(String_val(v))
#define Safe_String_val(v) memcpy(malloc(caml_string_length(v) + 1), String_val(v), caml_string_length(v) + 1)

CAMLprim value
caml_alloc_some(value v);
Expand Down

0 comments on commit aca8896

Please sign in to comment.