OSSP CVS Repository

ossp - Difference in ossp-pkg/uuid/uuid.c versions 1.59 and 1.60
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/uuid/uuid.c 1.59 -> 1.60

--- uuid.c       2006/05/11 09:37:28     1.59
+++ uuid.c       2006/07/28 18:22:43     1.60
@@ -105,13 +105,26 @@
     if ((obj = (uuid_t *)malloc(sizeof(uuid_t))) == NULL)
         return UUID_RC_MEM;
 
-    /* create PRNG, MD5 and SHA1 sub-objects */
-    if (prng_create(&obj->prng) != PRNG_RC_OK)
+    /* create PRNG sub-object */
+    if (prng_create(&obj->prng) != PRNG_RC_OK) {
+        free(obj);
         return UUID_RC_INT;
-    if (md5_create(&obj->md5) != MD5_RC_OK)
+    }
+
+    /* create MD5 sub-object */
+    if (md5_create(&obj->md5) != MD5_RC_OK) {
+        prng_destroy(obj->prng);
+        free(obj);
         return UUID_RC_INT;
-    if (sha1_create(&obj->sha1) != SHA1_RC_OK)
+    }
+
+    /* create SHA1 sub-object */
+    if (sha1_create(&obj->sha1) != SHA1_RC_OK) {
+        md5_destroy(obj->md5);
+        prng_destroy(obj->prng);
+        free(obj);
         return UUID_RC_INT;
+    }
 
     /* set UUID object initially to "Nil UUID" */
     uuid_load(obj, "nil");

CVSTrac 2.0.1