Message ID | 20211027201103.1668266-1-luiz.dentz@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [BlueZ] device: Fix not clearing error on update_bredr_services | expand |
Context | Check | Description |
---|---|---|
tedd_an/checkpatch | success | Checkpatch PASS |
tedd_an/gitlint | success | Gitlint PASS |
tedd_an/setupell | success | Setup ELL PASS |
tedd_an/buildprep | success | Build Prep PASS |
tedd_an/build | success | Build Configuration PASS |
tedd_an/makecheck | success | Make Check PASS |
tedd_an/makedistcheck | success | Make Distcheck PASS |
tedd_an/build_extell | success | Build External ELL PASS |
tedd_an/build_extell_make | success | Build Make with External ELL PASS |
This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=571395 ---Test result--- Test Summary: CheckPatch PASS 1.38 seconds GitLint PASS 0.88 seconds Prep - Setup ELL PASS 52.02 seconds Build - Prep PASS 0.48 seconds Build - Configure PASS 9.53 seconds Build - Make PASS 220.14 seconds Make Check PASS 10.02 seconds Make Distcheck PASS 254.72 seconds Build w/ext ELL - Configure PASS 8.72 seconds Build w/ext ELL - Make PASS 208.22 seconds --- Regards, Linux Bluetooth
diff --git a/src/device.c b/src/device.c index 8ad338419..612d093a5 100644 --- a/src/device.c +++ b/src/device.c @@ -4998,22 +4998,28 @@ static void update_bredr_services(struct browse_req *req, sdp_list_t *recs) snprintf(sdp_file, PATH_MAX, STORAGEDIR "/%s/cache/%s", srcaddr, dstaddr); + create_file(sdp_file, 0600); sdp_key_file = g_key_file_new(); if (!g_key_file_load_from_file(sdp_key_file, sdp_file, 0, &gerr)) { error("Unable to load key file from %s: (%s)", sdp_file, gerr->message); - g_error_free(gerr); + g_clear_error(&gerr); + g_key_file_free(sdp_key_file); + sdp_key_file = NULL; } snprintf(att_file, PATH_MAX, STORAGEDIR "/%s/%s/attributes", srcaddr, dstaddr); + create_file(att_file, 0600); att_key_file = g_key_file_new(); if (!g_key_file_load_from_file(att_key_file, att_file, 0, &gerr)) { error("Unable to load key file from %s: (%s)", att_file, gerr->message); - g_error_free(gerr); + g_clear_error(&gerr); + g_key_file_free(att_key_file); + att_key_file = NULL; } for (seq = recs; seq; seq = seq->next) { @@ -5068,7 +5074,6 @@ next: if (sdp_key_file) { data = g_key_file_to_data(sdp_key_file, &length, NULL); if (length > 0) { - create_file(sdp_file, 0600); if (!g_file_set_contents(sdp_file, data, length, &gerr)) { error("Unable set contents for %s: (%s)", @@ -5084,7 +5089,6 @@ next: if (att_key_file) { data = g_key_file_to_data(att_key_file, &length, NULL); if (length > 0) { - create_file(att_file, 0600); if (!g_file_set_contents(att_file, data, length, &gerr)) { error("Unable set contents for %s: (%s)",
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> When trying to loads contents from file using g_key_file_load_from_file it may cause an error which needs to be cleared since the gerr is reused, also make sure the file is always created upfront to avoid having such error when storage has not been initialized. --- src/device.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)