cloning %any ID without zero-byte memleak
authorMartin Willi <martin@strongswan.org>
Mon, 16 Apr 2007 08:37:52 +0000 (08:37 -0000)
committerMartin Willi <martin@strongswan.org>
Mon, 16 Apr 2007 08:37:52 +0000 (08:37 -0000)
src/libstrongswan/utils/identification.c

index 8c2f4f3..673cbb8 100644 (file)
@@ -963,7 +963,10 @@ static identification_t *clone_(private_identification_t *this)
        private_identification_t *clone = identification_create();
        
        clone->type = this->type;
-       clone->encoded = chunk_clone(this->encoded);
+       if (this->encoded.len)
+       {
+               clone->encoded = chunk_clone(this->encoded);
+       }
        clone->public.equals = this->public.equals;
        clone->public.matches = this->public.matches;