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
Unknown Object (File)
Sun, Feb 22, 12:31 AM
Unknown Object (File)
Sat, Feb 21, 11:10 PM
Unknown Object (File)
Mon, Feb 16, 12:45 PM
Unknown Object (File)
Wed, Feb 4, 1:39 AM
Unknown Object (File)
Jan 18 2026, 5:30 PM
Unknown Object (File)
Jan 18 2026, 3:23 PM
Unknown Object (File)
Jan 18 2026, 6:38 AM
Unknown Object (File)
Jan 8 2026, 6:48 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 ;(