-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misc. fixes #1121
Merged
Merged
Misc. fixes #1121
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3d0675b
utils: iio_rwdev: Fix out-of-scope reference to stack variable
pcercuei 92a0928
buffer: Free attributes list when destroying buffer
pcercuei 28efc96
network: Fix memory leak in network_create_context()
pcercuei baa4fbd
context: Fix non-working concatenation of context descriptions
pcercuei b7c796c
iiod-responder: Fix potential use-after-free caused by race
pcercuei a310cef
iio-responder: Remove useless local variable
pcercuei 2f009a9
local: Fix use-after-free
pcercuei 18f27cd
local: Fix double-free of context pdata
pcercuei File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
description == null
andctx->description
is a valid pointer this will free the valid pointer and then assignnew_description
(which isnull
) toctx-description
.I'll try to send a patch this weekend. 🤞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct... good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I disagree. If
description
is NULL it makes sense thatctx->description
is set to NULL, no?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, I think you are right. It would make sense if the description was replaced, but the code tries to append the old description to the new one.
So please send a PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick replies! Just out of curiosity, how is
description
here normally populated? In my case I'm runningiio_info -u "serial:..."
and IIOD on an MCU.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it is populated by the XML backend from the XML string sent by IIOD, which itself will get the description from the libiio backend's
iio_backend
struct.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry that wasn't phrased clearly. 😅 I understand how it works in my case.
I was curious in what cases the
description
that is passed in as an argument toiio_create_context_from_xml()
will not benull
, which I assume is the "normal" use case.Or said otherwise, why are there potentially two descriptions that need to be concatenated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It happens e.g. with the network backend, which prepends the IP address to the description found in the XML string.