Skip to content

Expand use of std::unique_ptr#533

Open
gaul wants to merge 4 commits intointel:masterfrom
gaul:unique_ptr
Open

Expand use of std::unique_ptr#533
gaul wants to merge 4 commits intointel:masterfrom
gaul:unique_ptr

Conversation

@gaul
Copy link
Contributor

@gaul gaul commented Mar 6, 2026

This eliminates the potentially-unsafe heap deallocation in the signal handler.

gaul added 3 commits March 9, 2026 15:50
This allows RAII for lock management and will enable clang
static lock analysis.

Signed-off-by: Andrew Gaul <andrew@gaul.org>
The latter is a less well-defined equivalent of the former.
References intel#495.

Signed-off-by: Andrew Gaul <andrew@gaul.org>
Signed-off-by: Andrew Gaul <andrew@gaul.org>
@spandruvada
Copy link
Contributor

merged to thermald-next

@spandruvada spandruvada reopened this Mar 10, 2026
@spandruvada
Copy link
Contributor

Caused coverity error:
image

@spandruvada
Copy link
Contributor

	gboolean thd_dbus_interface_reinit(PrefObject *obj, GError **error) {
208  		bool exclusive_control = false;
209  	
(1) Event cond_true: Condition "thd_engine->get_control_mode() == EXCLUSIVE", taking true branch.

@spandruvada
Copy link
Contributor

The three pull requests in thermald-next caused coverity errors:
Without them
Defect occurrences found : 5 Total
1 COPY_INSTEAD_OF_MOVE
2 PASS_BY_VALUE
2 USE_AFTER_MOVE

"Make borrowing of pointer clearer for cppcheck"
"Expand use of std::unique_ptr"
"Convert pthread_mutex_t to C++11 std::mutex"

With those three commits :
Defect occurrences found : 9 Total
1 COPY_INSTEAD_OF_MOVE
1 LOCK_EVASION
2 MISSING_LOCK
2 PASS_BY_VALUE
1 RESOURCE_LEAK
2 USE_AFTER_MOVE

So please recheck the three commits. I can remove and reapply.

@gaul
Copy link
Contributor Author

gaul commented Mar 10, 2026

How can I access the Coverity report?

@gaul
Copy link
Contributor Author

gaul commented Mar 10, 2026

I might understand the RESOURCE_LEAK without the report. I expect the global destructor for thd_engine to run but perhaps the call to exit confuses Coverity? It would be better if thermald interrupted the event loop to exit but let me make the smaller change first.

This eliminates the potentially-unsafe heap deallocation in the signal
handler.

Signed-off-by: Andrew Gaul <andrew@gaul.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants