summaryrefslogtreecommitdiffstats
path: root/psession.c
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2009-12-18 08:23:08 -0700
committerRob Crittenden <rcritten@redhat.com>2010-04-12 16:50:59 -0400
commita2f68c345a45554aeabae0382f90444e00552300 (patch)
treec2fe57c9b821ec9d827b744e2549654bfd3716db /psession.c
parent36c0348e68e7aa8126b1e1f78c83de0979973c1b (diff)
downloadpemnss-a2f68c345a45554aeabae0382f90444e00552300.tar.gz
pemnss-a2f68c345a45554aeabae0382f90444e00552300.tar.xz
pemnss-a2f68c345a45554aeabae0382f90444e00552300.zip
Make CopyObject return a new, shallow copy
Due to the semantics or possibly a bug in NSSCKFWC_CopyObject(), the pem CopyObject function must return a new mdObject *. So this patch creates a new mdObject as a shallow copy of the old one.
Diffstat (limited to 'psession.c')
-rw-r--r--psession.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/psession.c b/psession.c
index 82f8b41..1532fdf 100644
--- a/psession.c
+++ b/psession.c
@@ -178,8 +178,16 @@ pem_mdSession_CopyObject
CK_RV * pError
)
{
+ NSSCKMDObject *rvmdObject = NULL;
pemInternalObject *io = (pemInternalObject *) mdOldObject->etc;
+ /* make a new mdObject */
+ rvmdObject = nss_ZNEW(arena, NSSCKMDObject);
+ if ((NSSCKMDObject *) NULL == rvmdObject) {
+ *pError = CKR_HOST_MEMORY;
+ return (NSSCKMDObject *) NULL;
+ }
+
if (NULL == io->list) {
io->refCount ++;
} else {
@@ -190,7 +198,10 @@ pem_mdSession_CopyObject
item = item->next;
}
}
- return mdOldObject;
+ /* struct (shallow) copy the old one */
+ *rvmdObject = *mdOldObject;
+
+ return rvmdObject;
}
CK_RV