Issue 17968: memory leak in listxattr() (original) (raw)

Issue17968

Created on 2013-05-13 09:48 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
listxattr_leak.patch pitrou,2013-05-13 09:48 review
Messages (8)
msg189114 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-05-13 09:48
os.listxattr() leaks its internal buffer when the first call to C listxattr() fails with ERANGE. This wasn't caught by the refleak bot, probably because xattrs are not enabled on it.
msg189127 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-05-13 13:19
LGTM
msg189134 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-05-13 14:05
LGTM
msg189156 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-05-13 17:48
New changeset 2187cf880e5b by Antoine Pitrou in branch '3.3': Issue #17968: Fix memory leak in os.listxattr(). http://hg.python.org/cpython/rev/2187cf880e5b New changeset 1fa1a021ed23 by Antoine Pitrou in branch 'default': Issue #17968: Fix memory leak in os.listxattr(). http://hg.python.org/cpython/rev/1fa1a021ed23
msg189157 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-05-13 17:49
Should be fixed now.
msg189189 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-05-14 00:53
Coverity complains that your patch has introduced a double free bug. Can you have a look, please? ** CID 1021198: Double free (USE_AFTER_FREE) /Modules/posixmodule.c: 10161 http://scan5.coverity.com:8080//sourcebrowser.htm?projectId=10226#mergedDefectId=1021198 ________________________________________________________________________ CID 1021198: Double free (USE_AFTER_FREE) /Modules/posixmodule.c: 10123 ( freed_arg) 10120 10121 if (length < 0) { 10122 if (errno == ERANGE) { >>> "free(void *)" frees "buffer". 10123 PyMem_FREE(buffer); 10124 continue; 10125 } 10126 path_error(&path); 10127 break; /Modules/posixmodule.c: 10161 ( double_free) 10158 exit: 10159 path_cleanup(&path); 10160 if (buffer) >>> CID 1021198: Double free (USE_AFTER_FREE) >>> Calling "free(void *)" frees pointer "buffer" which has already been freed. 10161 PyMem_FREE(buffer); 10162 return result; 10163 } 10164 10165 #endif /* USE_XATTRS */
msg189190 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-05-14 00:56
New changeset 7aa157971810 by Benjamin Peterson in branch '3.3': prevent double free in cleanup code (#17968) http://hg.python.org/cpython/rev/7aa157971810 New changeset 617cb2f978b0 by Benjamin Peterson in branch 'default': merge 3.3 (#17968) http://hg.python.org/cpython/rev/617cb2f978b0
msg189191 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-05-14 00:57
Technically a false alarm but it is a danger in the future.
History
Date User Action Args
2022-04-11 14:57:45 admin set github: 62168
2013-05-14 00:57:22 benjamin.peterson set status: open -> closedmessages: +
2013-05-14 00:56:47 python-dev set messages: +
2013-05-14 00:53:34 christian.heimes set status: closed -> opennosy: + christian.heimesmessages: +
2013-05-13 17:49:21 pitrou set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2013-05-13 17:48:57 python-dev set nosy: + python-devmessages: +
2013-05-13 14:05:11 benjamin.peterson set messages: +
2013-05-13 13:19:44 serhiy.storchaka set nosy: + serhiy.storchakamessages: +
2013-05-13 09:48:46 pitrou create