RDKEMW-22210: Fix coverity issues on xdial - #211
Open
balav08 wants to merge 1 commit into
Open
Conversation
Reason for change: Fixing coverity reported issues. Test Procedure: Refer ticket. Risks: Low Priority: P1 version: minor Signed-off-by: balaji velmurugan <balaji_velmurugan@comcast.com>
There was a problem hiding this comment.
Pull request overview
This PR targets Coverity-reported issues in the xdial server implementation, primarily by adding NULL checks and tightening memory/resource handling in the REST and SSDP paths.
Changes:
- Add NULL-guarding around request payload logging and additional-data URL escaping in the libsoup 3.0 REST POST handler.
- Free an allocated handler path string in the libsoup 2.4 SSDP initialization path to address a resource leak.
- Add a NULL check around
gdial_app_state_to_string()usage when building the app state XML response.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| server/libsoup/3.0/gdial-rest.c | Adds Coverity-driven NULL checks and adjusts string initialization in response builder logic. |
| server/libsoup/2.4/gdial-ssdp.c | Frees dail_ssdp_handler after handler registration to address a reported leak. |
| server/gdial-app.c | Guards against NULL state string when creating the <state> XML node. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+436
to
+438
| // coverity fix : FORWARD_NULL - check for NULL request_body->data before using in log | ||
| const char *payload_str = (request_body && request_body->data) ? request_body->data : ""; | ||
| GDIAL_LOGERROR("Starting the app with payload %.*s", (int)request_body->length, payload_str); |
Comment on lines
+503
to
+504
| if (additional_data_url_safe) free(additional_data_url_safe); | ||
| if (additional_data_url) g_free(additional_data_url); |
Comment on lines
+532
to
+534
| // coverity fix : USE_AFTER_FREE - check for NULL before using state_str | ||
| const gchar *state_str = gdial_app_state_to_string(state); | ||
| if (state_str) { |
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.
Reason for change: Fixing coverity reported issues.
Test Procedure: Refer ticket.
Risks: Low
Priority: P1
version: minor