From 8aa9f42d914a453a0570752ee292b9a9cfcae9d6 Mon Sep 17 00:00:00 2001
From: Tucker Evans <tucker@tuckerevans.com>
Date: Sat, 4 Jul 2020 22:07:23 -0400
Subject: Fix vector print function now frees string representations

---
 collections/vector/vector.adoc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'collections/vector/vector.adoc')

diff --git a/collections/vector/vector.adoc b/collections/vector/vector.adoc
index e3fa94a..ce91c71 100644
--- a/collections/vector/vector.adoc
+++ b/collections/vector/vector.adoc
@@ -1,7 +1,7 @@
 Vector
 ======
 Tucker Evans
-v0.15, 2020-07-04
+v0.16, 2020-07-04
 
 A basic vector, that hold pointers to your data structures.
 
@@ -112,6 +112,9 @@ brackets and separated by commas ','). +to_string+ is a function that takes a
 pointer to the type of elements stored in +self+ and returns a string
 representation.
 
+NOTE: Strings are freed after printing, therefore +strdup()+ should be used on
+any strings that are not for the sole purpose of printing here.
+
 Examples
 ^^^^^^^^
 [source,c]
@@ -122,7 +125,7 @@ Examples
 char* to_string(str)
 void *str;
 {
-	return str;
+	return strdup(str);
 }
 
 int main()
-- 
cgit v1.1

