Fix uninitialized memory in allocate_daqp_workspace and Eigen interface#148
Draft
Fix uninitialized memory in allocate_daqp_workspace and Eigen interface#148
allocate_daqp_workspace and Eigen interface#148Conversation
Agent-Logs-Url: https://github.com/darnstrom/daqp/sessions/a6cbbad6-9b3e-469c-a577-ec48405ebead Co-authored-by: darnstrom <[email protected]>
Copilot
AI
changed the title
[WIP] Analyze latest version of daqp for memory leaks and uninitialized memory
Fix uninitialized memory in Mar 27, 2026
allocate_daqp_workspace and Eigen interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Valgrind identified 111 uninitialized-memory errors across the Eigen C++ tests (03, 04, 05) and zero memory leaks. Three bugs fixed:
work->m/work->msnever initialized (src/api.c):allocate_daqp_workspacesetwork->nbut leftwork->mandwork->msas garbage. TheDAQPclass calls this function in its constructor, andresize_resultthen comparesm != work_.mbeforedaqp_update_ldphas had a chance to populate those fields.slack_allocated but not zeroed (daqp.cpp):EigenDAQPResult::resize_dualusedslack_.resize(m), which allocates without initializing. Callers copying the result and callingget_slack()beforeset_slack()received garbage values. Changed toslack_.setZero(m).DAQP::solve(A, bu, bl, break_points)returned result with unpopulated slack (daqp.cpp): Unlike the standalonedaqp_solve(), the class method never calledset_slackbefore returning. Added aget_slack()call so that a copiedEigenDAQPResultcarries valid slack data, matching the static function's behavior.💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.