Search Linux Wireless

[PATCH] crda: don't memset ctx before releasing members

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



reglib_free_regdb_ctx() is currently memsetting the passed context to
all 0s and then attempts to unmap/release its members.

Obviouly this can't work, because after the memset() all ctx's members
will not be useful anymore. Attempting to release them may actually lead
to crashes. Even if no crash should happen, this operation will still
result in memleaks.

Fix this issue by removing the memset() at all, thus leaving the members
intact so that they can be properly released.

Signed-off-by: Kelvin Chui <kelvin.chui@xxxxxxxxx>
Signed-off-by: Antonio Quartulli <a@xxxxxxxxxxx>
---
 reglib.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/reglib.c b/reglib.c
index 4dee401..9a56a6d 100644
--- a/reglib.c
+++ b/reglib.c
@@ -287,7 +287,6 @@ void reglib_free_regdb_ctx(const struct reglib_regdb_ctx *regdb_ctx)
 
 	ctx = (struct reglib_regdb_ctx *) regdb_ctx;
 
-	memset(ctx, 0, sizeof(struct reglib_regdb_ctx));
 	close(ctx->fd);
 	munmap(ctx->db, ctx->real_dblen);
 	free(ctx);
-- 
2.27.0




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux