Skip to content

Fix two small memory leaks in the camera import dialog#21326

Merged
TurboGit merged 1 commit into
darktable-org:masterfrom
jeffc:mem-leaks
Jun 16, 2026
Merged

Fix two small memory leaks in the camera import dialog#21326
TurboGit merged 1 commit into
darktable-org:masterfrom
jeffc:mem-leaks

Conversation

@jeffc

@jeffc jeffc commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

These were identified and fixed by AI tools as part of #21319 . Created a separate PR at the request of the reviewers there.

The leak in camera_control.c was caused when a caller-allocated list was sorted in dt_camctl_import(). When the caller later went to free the list, it no longer had access to all of the list elements. Fixed by allocating and later freeing a scope-local shallow copy of the list.

The leak in camera_jobs.c was caused by a shallow call to free, which orphaned the underlying dynamically-allocated string data. Fixed by changing g_list_free() to g_list_free_full().

@jeffc

jeffc commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

Reverting to draft until I figure out build failures. My test build must have been using a cached result

@victoryforce

Copy link
Copy Markdown
Collaborator

@jeffc Your commit contains a part of your feature adding PR code working with a new member of the dt_camera_files_t structure that does not yet exist within this PR.

@jeffc

jeffc commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

That's what I get for trying to quickly split the PR on my lunch break. I fixed the build (removed references to size) and updated the PR description.

@jeffc jeffc marked this pull request as ready for review June 15, 2026 21:29
@jenshannoschwalm

Copy link
Copy Markdown
Collaborator

Ok & nice, squashing all three commits and force_push would be even better :-)

@TurboGit

Copy link
Copy Markdown
Member

Also, please never merge master branch into a topic branch. The workflow is either to rebase or do nothing if there is no conflicts.

@jeffc

jeffc commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Ok & nice, squashing all three commits and force_push would be even better :-)

Done!

Also, please never merge master branch into a topic branch. The workflow is either to rebase or do nothing if there is no conflicts.

Fixed

@TurboGit TurboGit added this to the 5.6 milestone Jun 16, 2026
@TurboGit TurboGit added the bugfix pull request fixing a bug label Jun 16, 2026

@TurboGit TurboGit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@TurboGit TurboGit merged commit 51474ff into darktable-org:master Jun 16, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix pull request fixing a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants