Skip to content
Snippets Groups Projects
Commit 27843f31 authored by Service qcabuildsw's avatar Service qcabuildsw Committed by Gerrit - the friendly Code Review server
Browse files

Merge "FM: Fix KW issues found in FM" into fm.lnx.2.0.4-rel

parents 5bb41552 1f19de06
No related branches found
No related tags found
No related merge requests found
...@@ -273,14 +273,26 @@ static void *hci_read_thread(void *arg) ...@@ -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); 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) if (!evt_buf) {
length = read_fm_event(hci, evt_buf, sizeof(struct fm_event_header_t) + MAX_FM_EVT_PARAMS); 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); ALOGD("length=%d\n",length);
if(length <=0) { if(length <=0) {
lib_running =0; lib_running =0;
} }
goto exit;
cleanup:
lib_running = 0;
hci = NULL;
exit:
ALOGV("%s: Leaving hci_read_thread()", __func__); ALOGV("%s: Leaving hci_read_thread()", __func__);
if (evt_buf)
free(evt_buf);
pthread_exit(NULL); pthread_exit(NULL);
return arg; return arg;
} }
......
...@@ -641,8 +641,11 @@ static inline void hci_ev_radio_text(char *buff) ...@@ -641,8 +641,11 @@ static inline void hci_ev_radio_text(char *buff)
while ((buff[len+RDS_OFFSET] != 0x0d) && (len < MAX_RT_LENGTH)) while ((buff[len+RDS_OFFSET] != 0x0d) && (len < MAX_RT_LENGTH))
len++; len++;
if (len == 0)
return;
ALOGV("%s:%s: radio text length=%d\n", LOG_TAG, __func__,len); 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) { if (!data) {
ALOGE("%s:Failed to allocate memory", LOG_TAG); ALOGE("%s:Failed to allocate memory", LOG_TAG);
return; return;
...@@ -654,11 +657,9 @@ static inline void hci_ev_radio_text(char *buff) ...@@ -654,11 +657,9 @@ static inline void hci_ev_radio_text(char *buff)
data[3] = buff[RDS_PID_HIGHER]; data[3] = buff[RDS_PID_HIGHER];
data[4] = buff[RT_A_B_FLAG_OFFSET]; data[4] = buff[RT_A_B_FLAG_OFFSET];
if (len > 0) { memcpy(data+RDS_OFFSET, &buff[RDS_OFFSET], len);
memcpy(data+RDS_OFFSET, &buff[RDS_OFFSET], len);
data[len+RDS_OFFSET] = 0x00;
}
data[len+RDS_OFFSET] = 0x00;
hal->jni_cb->rt_update_cb(data); hal->jni_cb->rt_update_cb(data);
free(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