summaryrefslogtreecommitdiffstats
path: root/byterun/compare.c
diff options
context:
space:
mode:
Diffstat (limited to 'byterun/compare.c')
-rw-r--r--byterun/compare.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/byterun/compare.c b/byterun/compare.c
index 3337f77d0..4cd6df29e 100644
--- a/byterun/compare.c
+++ b/byterun/compare.c
@@ -199,7 +199,10 @@ static intnat compare_val(value v1, value v2, int total)
case Custom_tag: {
int res;
int (*compare)(value v1, value v2) = Custom_ops_val(v1)->compare;
- if (compare == NULL) caml_invalid_argument("equal: abstract value");
+ if (compare == NULL) {
+ compare_free_stack();
+ caml_invalid_argument("equal: abstract value");
+ }
caml_compare_unordered = 0;
res = Custom_ops_val(v1)->compare(v1, v2);
if (caml_compare_unordered && !total) return UNORDERED;