From fbeefb873a1b9103e1c6449b64c172aa4654addd Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Wed, 12 Oct 2016 12:44:13 +0200 Subject: gfapi: warn when glfs_realpath() returned malloc'd memory glfs_realpath() may return memory allocated with malloc(). Depending on the memory allocator that the application uses, calling free() on the returned string can cause segmentation faults or other problems. Functions that allocate memory, need to match the free'ing of the same memory allocator and memory accounting. glibc/malloc and jemalloc/free do not match together (other allocators could probably trigger these problems as well). Applications need to provide a pre-allocated buffer, or in case glfs_realpath() allocates the memory, glfs_free() should be used to free it. Cherry picked from commit 85e959052148ec481823d55c8b91cdee36da2b43: > Change-Id: I5d721a7425674aa700db8a7a436cbedb95a5927f > BUG: 1370931 > Signed-off-by: Niels de Vos > Reviewed-on: http://review.gluster.org/15332 > CentOS-regression: Gluster Build System > Smoke: Gluster Build System > NetBSD-regression: NetBSD Build System > Reviewed-by: Kaleb KEITHLEY Change-Id: I5d721a7425674aa700db8a7a436cbedb95a5927f BUG: 1383593 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/15628 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Kaleb KEITHLEY --- api/src/gfapi.map | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'api/src/gfapi.map') diff --git a/api/src/gfapi.map b/api/src/gfapi.map index f38ef024181..ca19baef896 100644 --- a/api/src/gfapi.map +++ b/api/src/gfapi.map @@ -186,3 +186,8 @@ GFAPI_3.7.16 { glfs_upcall_inode_get_oldpobject; glfs_upcall_inode_get_oldpstat; } GFAPI_3.7.15; + +GFAPI_3.7.17 { + global: + glfs_realpath; +} GFAPI_3.7.16; -- cgit