[PATCH] l2_packet: fix eloop leak when using l2_packet_none

Jouni Malinen j at w1.fi
Sun Apr 13 17:20:51 EDT 2014


On Thu, Mar 20, 2014 at 07:24:53PM +0100, Maxime Bizon wrote:
>  src/l2_packet/l2_packet_none.c |    2 --

What are you using l2_packet_none.c for? It is just a minimal template
showing how an l2_packet wrapper could be implemented.

> diff --git a/src/l2_packet/l2_packet_none.c b/src/l2_packet/l2_packet_none.c
> @@ -84,7 +84,6 @@ struct l2_packet_data * l2_packet_init(
> -	eloop_register_read_sock(l2->fd, l2_packet_receive, l2, NULL);

This would remove the only use of l2_packet_receive() and result in a
compilation warning (or error in my case since I include -Werror for
gcc).

> @@ -96,7 +95,6 @@ void l2_packet_deinit(struct l2_packet_data *l2)
>  	if (l2->fd >= 0) {
> -		eloop_unregister_read_sock(l2->fd);
>  		/* TODO: close connection */

Would probably be more valuable for the example to maintain these calls
in the file somehow, e.g., by making registration use something like "if
(l2->fd >= 0)" as the condition (i.e., compiler will remove it, but does
not complain about unused static function).
 
-- 
Jouni Malinen                                            PGP id EFC895FA


More information about the HostAP mailing list