Issue 5105 - lmdb - Cannot create entries with long rdn - fix covscan #6131
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.
A minor code cleanup issue fixing: CID 1540880 CID 1540879 CID 1540878 CID 1540876 CID 1540875
All these report have the same pattern but on different function.
The issue is that ctx == NULL is tested as part of the parameter validity tests (even if it is never NULL)
then goto bail but the bail code dereference ctx to potentially free some resources.
So I changed the code from:
Log Entering in Function
If (One of parameter is NULL) {
Log Error message
goto bail
}
To:
If (One of parameter is NULL) {
Log Error message
return -1;
}
Log Entering in Function
CID 1540877 is a real issue about a potential memory leak in case of error (shoud goto bail0 instead of bail to make sure childelem is free)
Issue: #6105
Reviewed by: @droideck Thanks!