Skip to content
Snippets Groups Projects
Commit 1f19de06 authored by Smriti Gupta's avatar Smriti Gupta
Browse files

FM: Fix KW issues found in FM

Fix KW issues found in FM.

CRs-Fixed: 1048393
Change-Id: I1e47753f96307005ebe1a90254fe885295c04669
parent ca24ce0b
No related branches found
No related tags found
No related merge requests found
......@@ -273,14 +273,26 @@ static void *hci_read_thread(void *arg)
struct fm_event_header_t *evt_buf = (struct fm_event_header_t *) malloc(sizeof(struct fm_event_header_t) + MAX_FM_EVT_PARAMS);
if (!evt_buf)
length = read_fm_event(hci, evt_buf, sizeof(struct fm_event_header_t) + MAX_FM_EVT_PARAMS);
if (!evt_buf) {
ALOGE("%s: Memory allocation failed for evt_buf", __func__);
goto cleanup;
}
length = read_fm_event(hci, evt_buf, sizeof(struct fm_event_header_t) + MAX_FM_EVT_PARAMS);
ALOGD("length=%d\n",length);
if(length <=0) {
lib_running =0;
}
goto exit;
cleanup:
lib_running = 0;
hci = NULL;
exit:
ALOGV("%s: Leaving hci_read_thread()", __func__);
if (evt_buf)
free(evt_buf);
pthread_exit(NULL);
return arg;
}
......
......@@ -641,8 +641,11 @@ static inline void hci_ev_radio_text(char *buff)
while ((buff[len+RDS_OFFSET] != 0x0d) && (len < MAX_RT_LENGTH))
len++;
if (len == 0)
return;
ALOGV("%s:%s: radio text length=%d\n", LOG_TAG, __func__,len);
data = malloc(len+RDS_OFFSET);
data = malloc(len+RDS_OFFSET+1);
if (!data) {
ALOGE("%s:Failed to allocate memory", LOG_TAG);
return;
......@@ -654,11 +657,9 @@ static inline void hci_ev_radio_text(char *buff)
data[3] = buff[RDS_PID_HIGHER];
data[4] = buff[RT_A_B_FLAG_OFFSET];
if (len > 0) {
memcpy(data+RDS_OFFSET, &buff[RDS_OFFSET], len);
data[len+RDS_OFFSET] = 0x00;
}
memcpy(data+RDS_OFFSET, &buff[RDS_OFFSET], len);
data[len+RDS_OFFSET] = 0x00;
hal->jni_cb->rt_update_cb(data);
free(data);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment