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
F163855831: D43747.diff
Sun, Jul 26, 3:48 PM
Unknown Object (File)
Sat, Jul 25, 1:08 AM
Unknown Object (File)
Mon, Jul 20, 6:19 AM
Unknown Object (File)
Sat, Jul 18, 9:32 AM
Unknown Object (File)
Jun 26 2026, 4:09 AM
Unknown Object (File)
Jun 24 2026, 7:14 PM
Unknown Object (File)
Jun 19 2026, 12:08 PM
Unknown Object (File)
May 31 2026, 8:16 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 ;(