summaryrefslogtreecommitdiff
path: root/byterun/io.c
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2015-04-21 15:20:10 +0000
committerDamien Doligez <damien.doligez-inria.fr>2015-04-21 15:20:10 +0000
commit0b3caf43bff9bce58b316491ec57f58f6a7d562d (patch)
tree4da1e9ab6d86b20ba061a467b42b6d1eca0fc789 /byterun/io.c
parent3b1a33c77bb845b52c9c141cf02c2c653e55f8de (diff)
downloadocaml-0b3caf43bff9bce58b316491ec57f58f6a7d562d.tar.gz
PR#6838: Invalid memory in C thread bindings (caused by commit 15817)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16025 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/io.c')
-rw-r--r--byterun/io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/byterun/io.c b/byterun/io.c
index ac7ea76bab..36e2f0c191 100644
--- a/byterun/io.c
+++ b/byterun/io.c
@@ -426,7 +426,6 @@ CAMLexport void caml_finalize_channel(value vchan)
{
struct channel * chan = Channel(vchan);
if (--chan->refcount > 0) return;
- if (caml_channel_mutex_free != NULL) (*caml_channel_mutex_free)(chan);
/* If the buffer is empty, remove the channel from the list of all
open channels and free it. Otherwise, keep it around so the Ocaml
[at_exit] function gets a chance to flush it.
@@ -434,6 +433,7 @@ CAMLexport void caml_finalize_channel(value vchan)
raise exceptions, which is forbidden in a finalization function.
*/
if (chan->curr == chan->buff){
+ if (caml_channel_mutex_free != NULL) (*caml_channel_mutex_free)(chan);
unlink_channel(chan);
caml_stat_free(chan);
}