phc2sys: free clock device when exit
Since we called strdup() for clock device, we need free the memory before exit. Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>master
parent
6b18e12b9b
commit
46cc187e82
11
phc2sys.c
11
phc2sys.c
|
@ -240,6 +240,16 @@ static struct clock *clock_add(struct node *node, char *device)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void clock_cleanup(struct node *node)
|
||||||
|
{
|
||||||
|
struct clock *c;
|
||||||
|
|
||||||
|
LIST_FOREACH(c, &node->clocks, list) {
|
||||||
|
if (c->device)
|
||||||
|
free(c->device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static struct port *port_get(struct node *node, unsigned int number)
|
static struct port *port_get(struct node *node, unsigned int number)
|
||||||
{
|
{
|
||||||
struct port *p;
|
struct port *p;
|
||||||
|
@ -1506,6 +1516,7 @@ int main(int argc, char *argv[])
|
||||||
end:
|
end:
|
||||||
if (node.pmc)
|
if (node.pmc)
|
||||||
close_pmc(&node);
|
close_pmc(&node);
|
||||||
|
clock_cleanup(&node);
|
||||||
config_destroy(cfg);
|
config_destroy(cfg);
|
||||||
return r;
|
return r;
|
||||||
bad_usage:
|
bad_usage:
|
||||||
|
|
Loading…
Reference in New Issue