fix fclose of permanent (stdin/out/err) streams
[musl] / src / stdio / open_memstream.c
index 9eafdfb..58504c9 100644 (file)
@@ -79,11 +79,5 @@ FILE *open_memstream(char **bufp, size_t *sizep)
 
        if (!libc.threaded) f->lock = -1;
 
-       OFLLOCK();
-       f->next = libc.ofl_head;
-       if (libc.ofl_head) libc.ofl_head->prev = f;
-       libc.ofl_head = f;
-       OFLUNLOCK();
-
-       return f;
+       return __ofl_add(f);
 }