diff options
author | Niels de Vos <ndevos@redhat.com> | 2015-03-11 23:00:09 -0400 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-03-15 07:08:21 -0700 |
commit | 2c3b6ab03262108f95d706b9ebaa207b352fc32c (patch) | |
tree | 4a831a0fbfee17e7b7b4855baa2d007cb05170b3 /xlators | |
parent | aa66b8404f45712c45d75d6a2a37f32e2792cc83 (diff) |
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 <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/9860
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/nfs/server/src/netgroups.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); |