-
Notifications
You must be signed in to change notification settings - Fork 170
RDKBWIFI-498: Fix EM subdoc memory leaks in webconfig decode and EM a… #1250
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,6 +94,36 @@ unsigned int translate_auth_type_from_easymesh(unsigned int authtype) | |
| } | ||
| } | ||
|
|
||
| #ifdef EM_APP | ||
| // the ap metrics report decoder mallocs per-vap sta arrays into the decoded | ||
| // params (see decode_em_ap_metrics_report_object); webconfig_data_free only | ||
| // frees u.encoded.raw, so they must be freed here after translation | ||
| static void webconfig_easymesh_free_ap_metrics_report(webconfig_subdoc_data_t *data) | ||
| { | ||
| webconfig_subdoc_decoded_data_t *decoded = &data->u.decoded; | ||
| int i, j; | ||
|
|
||
| if (data->type != webconfig_subdoc_type_em_ap_metrics_report) { | ||
| return; | ||
| } | ||
|
|
||
| for (i = 0; i < MAX_NUM_RADIOS; i++) { | ||
| for (j = 0; j < MAX_NUM_VAP_PER_RADIO; j++) { | ||
| em_vap_metrics_t *vap_report = &decoded->em_ap_metrics_report.radio_reports[i].vap_reports[j]; | ||
|
|
||
| if (vap_report->sta_traffic_stats != NULL) { | ||
| free(vap_report->sta_traffic_stats); | ||
| vap_report->sta_traffic_stats = NULL; | ||
| } | ||
| if (vap_report->sta_link_metrics != NULL) { | ||
| free(vap_report->sta_link_metrics); | ||
| vap_report->sta_link_metrics = NULL; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| #endif | ||
|
|
||
| // webconfig_easymesh_decode() will convert the onewifi structures to easymesh structures | ||
| webconfig_error_t webconfig_easymesh_decode(webconfig_t *config, const char *str, | ||
| webconfig_external_easymesh_t *data, | ||
|
|
@@ -111,6 +141,9 @@ webconfig_error_t webconfig_easymesh_decode(webconfig_t *config, const char *str | |
| wifi_util_info_print(WIFI_WEBCONFIG,"%s:%d: Easymesh decode subdoc type %d sucessfully\n", __func__, __LINE__, webconfig_easymesh_data.type); | ||
| *type = webconfig_easymesh_data.type; | ||
| //debug_external_protos(&webconfig_easymesh_data, __func__, __LINE__); | ||
| #ifdef EM_APP | ||
| webconfig_easymesh_free_ap_metrics_report(&webconfig_easymesh_data); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think instead of this, we can cleanup in the corresponding translation function itself, something as below:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If its urgent to be merged, we can bring this change as a seperate PR too! |
||
| #endif | ||
| webconfig_data_free(&webconfig_easymesh_data); | ||
| return webconfig_error_none; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.