Page MenuHomeFreeBSD

libcuse: Fix memory leak in cuse_init()
Needs ReviewPublic

Authored by zlei on Feb 5 2024, 6:48 AM.
Tags
None
Referenced Files
F162927473: D43747.id133866.diff
Sat, Jul 18, 9:32 AM
Unknown Object (File)
Fri, Jun 26, 4:09 AM
Unknown Object (File)
Wed, Jun 24, 7:14 PM
Unknown Object (File)
Fri, Jun 19, 12:08 PM
Unknown Object (File)
May 31 2026, 8:16 AM
Unknown Object (File)
May 30 2026, 12:42 AM
Unknown Object (File)
May 28 2026, 2:57 AM
Unknown Object (File)
May 18 2026, 9:42 AM
Subscribers

Details

Reviewers
kib
markj
Summary

The mutex attributes object should be destroyed after been used.

Where here also check return value of pthread_mutexattr_init() to
prevent potential writing in unallocated memory or NULL pointer
dereferencing when the system is out of memory.

This fix is inspired by the recent commit a03f768612ad
(libstdthreads: destroy mutexattr in mtx_init()) .

MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

zlei requested review of this revision.Feb 5 2024, 6:48 AM
lib/libcuse/cuse_lib.c
113

Emm, return value of pthread_mutex_init() is not checked ;(