Free memory on return
leaked_storage: Variable nkey going out of scope leaks the storage it points to.
Found by Coverity
@@ -338,8 +338,10 @@ migrate_unique_key (char *key) {
nkey = xstrdup ("");
while ((ptr = strchr (key, '|'))) {
- if (!(token = extract_by_delim (&key, "|")))
+ if (!(token = extract_by_delim (&key, "|"))) {
+ free (nkey);
return NULL;
+ }
append_str (&nkey, token);
append_str (&nkey, "|");
