summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--std/queue.zc2
-rw-r--r--std/stack.zc2
2 files changed, 2 insertions, 2 deletions
diff --git a/std/queue.zc b/std/queue.zc
index 31e5dbd..3e99eba 100644
--- a/std/queue.zc
+++ b/std/queue.zc
@@ -25,7 +25,7 @@ impl Queue<T> {
new_queue.len = self.len;
new_queue.cap = self.cap;
new_queue.data = malloc(sizeof(T) * new_queue.cap);
- memcpy(new_queue.data, self.data, sizeof(T) * new_queue.cap);
+ memcpy(new_queue.data, self.data, sizeof(T) * new_queue.len);
return new_queue;
}
diff --git a/std/stack.zc b/std/stack.zc
index 7df77f1..db02f2d 100644
--- a/std/stack.zc
+++ b/std/stack.zc
@@ -25,7 +25,7 @@ impl Stack<T> {
new_stack.len = self.len;
new_stack.cap = self.cap;
new_stack.data = malloc(sizeof(T) * new_stack.cap);
- memcpy(new_stack.data, self.data, sizeof(T) * new_stack.cap);
+ memcpy(new_stack.data, self.data, sizeof(T) * new_stack.len);
return new_stack;
}