From 2c3b6ab03262108f95d706b9ebaa207b352fc32c Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Wed, 11 Mar 2015 23:00:09 -0400 Subject: nfs: use free() for getline() allocated string in netgroups 'line' is allocated through getline() which uses malloc(). GF_FREE() will fail to release the memory because it can not find the expected mem-pool header. Instead of GF_FREE(), free() should be used for strings that get allocated with getline(). Subsequent calls to getline() with a non-NULL pointer will get the size of the allocation adjusted with realloc(). Change-Id: I612fbf17d7283174d541da6f34d26e4f44e83bfa BUG: 1143880 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/9860 Tested-by: Gluster Build System Reviewed-by: Kaleb KEITHLEY Reviewed-by: Vijay Bellur --- xlators/nfs/server/src/netgroups.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'xlators/nfs/server') diff --git a/xlators/nfs/server/src/netgroups.c b/xlators/nfs/server/src/netgroups.c index c605ca2664c..f5c966948f7 100644 --- a/xlators/nfs/server/src/netgroups.c +++ b/xlators/nfs/server/src/netgroups.c @@ -1122,7 +1122,8 @@ ng_file_parse (const char *filepath) } } - GF_FREE (line); + /* line got allocated through getline(), don't use GF_FREE() for it */ + free (line); if (fp) fclose(fp); -- cgit