From 2f9c79b29c26b0c3ef483ae8da1c4cc31af6f12f Mon Sep 17 00:00:00 2001 From: niu Date: Tue, 13 Sep 2005 02:49:34 +0000 Subject: [PATCH] enlarge namelen to make caller can free mem with correct size --- lustre/mds/mds_audit_path.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lustre/mds/mds_audit_path.c b/lustre/mds/mds_audit_path.c index 6b64c86..7e408e1 100644 --- a/lustre/mds/mds_audit_path.c +++ b/lustre/mds/mds_audit_path.c @@ -575,7 +575,9 @@ next: item = list_entry(pos, struct name_item, link); *namelen += strlen(item->name) + 1; } - OBD_ALLOC(*name, *namelen + 1); + + *namelen++; /* for the ending '\0' of string */ + OBD_ALLOC(*name, *namelen); if (*name == NULL) rc = -ENOMEM; out: @@ -588,7 +590,7 @@ out: } list_del_init(&item->link); OBD_FREE(item, sizeof(*item)); - LASSERT(strlen(*name) <= *namelen); + LASSERT(strlen(*name) < namelen); } RETURN(rc); } -- 1.8.3.1