fence-virt: Fix return with lock held

Release the parser mutex before returning if malloc
fails.

Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
This commit is contained in:
Ryan McCabe 2012-10-17 11:00:21 -04:00
parent b35ac70bf2
commit 9b8bc5ba1c

View File

@ -434,8 +434,10 @@ _sc_parse(const char *filename, void **config)
}
c = malloc(sizeof(*c));
if (!c)
return -1;
if (!c) {
ret = -1;
goto out_unlock;
}
c->node_list = node_list;
c->val_list = val_list;
c->next = NULL;
@ -446,8 +448,8 @@ _sc_parse(const char *filename, void **config)
if (fp)
fclose(fp);
out_unlock:
pthread_mutex_unlock(&parser_mutex);
return ret;
}