[PATCH] atheros_driver: Unify memory processing functions

Jouni Malinen j at w1.fi
Thu Dec 17 13:29:46 PST 2015


On Sat, Dec 12, 2015 at 10:25:42AM +0000, Matt Woods wrote:
> There are two types of memory processing functions in the file
> atheros_driver.c,such as memory and os_memory. Unify the processing
> functions into one type which has the prefix "os_".

In general, this is a good direction..

However, this has an issue:

> diff --git a/src/drivers/driver_atheros.c b/src/drivers/driver_atheros.c
> @@ -1435,7 +1435,7 @@ atheros_wireless_event_wireless(struct atheros_driver_data *drv,
>  			buf = malloc(iwe->u.data.length + 1);
...
> @@ -1446,7 +1446,7 @@ atheros_wireless_event_wireless(struct atheros_driver_data *drv,
>  				atheros_wireless_event_wireless_custom(
>  					drv, buf, buf + iwe->u.data.length);
>  			}
> -			free(buf);
> +			os_free(buf);

os_free() can be used only with allocations made through os_*() style
functions, i.e., that malloc() above has to replaced with os_malloc() to
avoid crashing the process when using memory allocation tracing. I'll
fix this in the patch.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list