On Thu, Sep 26, 2019 at 03:54:32PM +0200, Miroslav Lichvar wrote:
> @@ -250,6 +252,45 @@ out:
> return err;
> }
>
> +static void free_master_table(struct unicast_master_table *table)
> +{
> + struct unicast_master_address *address;
> +
> + while ((address = STAILQ_FIRST(&table->addrs))) {
> + STAILQ_REMOVE_HEAD(&table->addrs, list);
> + free(address);
> + }
> + free(table->peer_name);
This needs test for table->peer_name != NULL ...
> + free(table);
> +}
> +
> +static struct unicast_master_table *
> +clone_master_table(struct unicast_master_table *table)
> +{
> + struct unicast_master_address *address, *cloned_address;
> + struct unicast_master_table *cloned_table;
> +
> + cloned_table = malloc(sizeof(*cloned_table));
> + if (!cloned_table)
> + return NULL;
> + *cloned_table = *table;
> + STAILQ_INIT(&cloned_table->addrs);
> + memset(&cloned_table->list, 0, sizeof(cloned_table->list));
> + if (table->peer_name)
> + cloned_table->peer_name = strdup(table->peer_name);
... doesn't it?
Thanks,
Richard
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel