Index: ossp-pkg/uuid/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/ChangeLog,v rcsdiff -q -kk '-r1.123' '-r1.124' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/ChangeLog,v' 2>/dev/null --- ChangeLog 2006/07/28 18:18:39 1.123 +++ ChangeLog 2006/07/28 18:22:43 1.124 @@ -13,6 +13,9 @@ Changes between 1.4.2 and 1.5.0 (13-Mar-2006 to XX-May-2006) + o Fixed potential memory leak in uuid_create() as spotted by SPLINT. + [Ralf S. Engelschall] + o Cleanup source code according to complains by SPLINT. [Ralf S. Engelschall] Index: ossp-pkg/uuid/uuid.c RCS File: /v/ossp/cvs/ossp-pkg/uuid/Attic/uuid.c,v rcsdiff -q -kk '-r1.59' '-r1.60' -u '/v/ossp/cvs/ossp-pkg/uuid/Attic/uuid.c,v' 2>/dev/null --- 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");