[PATCH] glibc/manual/examples: add missing free to open_memstream example

Ravina Jain rajulravina123@gmail.com
Mon Jun 23 10:41:16 GMT 2025


---
 manual/examples/memstrm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/manual/examples/memstrm.c b/manual/examples/memstrm.c
index 9ee6298a35..672aec3e2c 100644
--- a/manual/examples/memstrm.c
+++ b/manual/examples/memstrm.c
@@ -16,6 +16,7 @@
 */
 
 #include <stdio.h>
+#include <stdlib.h>
 
 int
 main (void)
@@ -31,6 +32,7 @@ main (void)
   fprintf (stream, ", world");
   fclose (stream);
   printf ("buf = `%s', size = %zu\n", bp, size);
+  free(bp);
 
   return 0;
 }
-- 
2.49.0



More information about the Libc-alpha mailing list