summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-05-22 18:16:42 -0400
committerRob Crittenden <rcritten@redhat.com>2009-05-22 18:16:42 -0400
commitf32266d0b8d4bfa2f228c0d3c3ed9869a2b3eb50 (patch)
treeb81ffc91b2f309994967d1b4ea063f9098a27c6f
parent99dd57c020efec97519ee46d29229d3df8914026 (diff)
downloadpemnss-f32266d0b8d4bfa2f228c0d3c3ed9869a2b3eb50.zip
pemnss-f32266d0b8d4bfa2f228c0d3c3ed9869a2b3eb50.tar.gz
pemnss-f32266d0b8d4bfa2f228c0d3c3ed9869a2b3eb50.tar.xz
Fix off-by-one error when computing size to reduce memory leak.
Patch contributed by Kamil Dudka. 483855
-rw-r--r--pobject.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/pobject.c b/pobject.c
index 62a8a38..0e968dc 100644
--- a/pobject.c
+++ b/pobject.c
@@ -987,10 +987,7 @@ pem_CreateObject
char *ivstring = NULL;
count = pem_nobjs;
- if (count > 0)
- size = ((count / PEM_ITEM_CHUNK) + 1) * PEM_ITEM_CHUNK;
- else
- size = 0;
+ size = (count / PEM_ITEM_CHUNK) * PEM_ITEM_CHUNK;
/*
* only create token objects