From 2f916086a662bc71b481287822b17c428e2850c2 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Fri, 17 Dec 2010 15:03:37 -0800 Subject: [PATCH] auth: avoid mismatched allocation Can't pair strdup and free. Signed-off-by: Colin McCabe --- src/auth/ExportControl.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/auth/ExportControl.cc b/src/auth/ExportControl.cc index 7339060c0b48d..238e83fe46e7f 100644 --- a/src/auth/ExportControl.cc +++ b/src/auth/ExportControl.cc @@ -82,7 +82,8 @@ void Subnet::parse(const char *str) { unsigned char ip[4], mask[4]; - char *mask_str = strdup(str); + char mask_str[strlen(str)+1]; + strcpy(mask_str, str); int ret; dout(30) << "Subnet::parse str=" << str << dendl; @@ -127,7 +128,6 @@ void Subnet::parse(const char *str) dout(30) << hex << GET_IP(&subnet.addr) << dec << dendl; valid = true; - delete mask_str; } class GroupEntry; -- 2.39.5