summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJune Kim <sena06.kim@samsung.com>2013-04-12 21:40:33 +0900
committerJune Kim <sena06.kim@samsung.com>2013-04-12 21:40:33 +0900
commit0d3d1872bae35e26d46473b146c31b446540a5c5 (patch)
tree86707237fe71a77b84e24afb87249a1a46c15805
parentcd09f84c00ba6bffffffc82536440d1af6e491ee (diff)
downloadlibslp-lbs-plugin-replay-0d3d1872bae35e26d46473b146c31b446540a5c5.tar.gz
libslp-lbs-plugin-replay-0d3d1872bae35e26d46473b146c31b446540a5c5.tar.bz2
libslp-lbs-plugin-replay-0d3d1872bae35e26d46473b146c31b446540a5c5.zip
Fix prevent
-rw-r--r--replay-plugin/src/gps_plugin_replay.c36
-rw-r--r--replay-plugin/src/nmea_parser.c7
2 files changed, 26 insertions, 17 deletions
diff --git a/replay-plugin/src/gps_plugin_replay.c b/replay-plugin/src/gps_plugin_replay.c
index 8f828d5..1cb8aa8 100644
--- a/replay-plugin/src/gps_plugin_replay.c
+++ b/replay-plugin/src/gps_plugin_replay.c
@@ -305,15 +305,13 @@ gboolean gps_plugin_replay_timeout_cb(gpointer data)
timer->sv_data->pos_valid = FALSE;
}
- if (timer != NULL) {
- if (g_gps_event_cb != NULL) {
- if (err != READ_NOT_FIXED) {
- gps_plugin_replay_pos_event(timer->pos_data);
- }
- gps_plugin_replay_sv_event(timer->sv_data);
+ if (g_gps_event_cb != NULL) {
+ if (err != READ_NOT_FIXED) {
+ gps_plugin_replay_pos_event(timer->pos_data);
}
- ret = TRUE;
+ gps_plugin_replay_sv_event(timer->sv_data);
}
+ ret = TRUE;
return ret;
}
@@ -435,13 +433,27 @@ replay_timeout *gps_plugin_replay_timer_init()
setting_notify_key_changed(VCONFKEY_LOCATION_REPLAY_MODE, replay_mode_changed_cb);
timer->pos_data = (pos_data_t *) malloc(sizeof(pos_data_t));
+ if (timer->pos_data == NULL) {
+ LOG_PLUGIN(DBG_ERR, "pos_data allocation is failed.");
+ free(timer);
+ return NULL;
+ }
timer->sv_data = (sv_data_t *) malloc(sizeof(sv_data_t));
- timer->nmea_data = (nmea_data_t *) malloc(sizeof(nmea_data_t));
+ if (timer->sv_data == NULL) {
+ LOG_PLUGIN(DBG_ERR, "sv_data allocation is failed.");
+ free(timer->pos_data);
+ free(timer);
+ return NULL;
+ }
- if (timer->pos_data == NULL || timer->sv_data == NULL || timer->nmea_data == NULL) {
- LOG_PLUGIN(DBG_ERR, "pos_data or sv_data or nmea_data allocation is failed.");
- return NULL;
- }
+ timer->nmea_data = (nmea_data_t *) malloc(sizeof(nmea_data_t));
+ if (timer->nmea_data == NULL) {
+ LOG_PLUGIN(DBG_ERR, "nmea_data allocation is failed.");
+ free(timer->pos_data);
+ free(timer->sv_data);
+ free(timer);
+ return NULL;
+ }
timer->timeout_src = NULL;
timer->default_context = NULL;
diff --git a/replay-plugin/src/nmea_parser.c b/replay-plugin/src/nmea_parser.c
index fc92c3c..daccee5 100644
--- a/replay-plugin/src/nmea_parser.c
+++ b/replay-plugin/src/nmea_parser.c
@@ -104,9 +104,6 @@ int nmea_parser_tokenize(char input[], char *token[])
state = 0;
}
break;
- default:
- state = 0;
- break;
}
s++;
}
@@ -325,7 +322,7 @@ static int nmea_parser_gpgsv(char *token[], sv_data_t * sv)
int nmea_parser_sentence(char *sentence, char *token[], pos_data_t * pos, sv_data_t * sv)
{
- int ret;
+ int ret = READ_ERROR;
if (strcmp(sentence, "GPGGA") == 0) {
ret = nmea_parser_gpgga(token, pos, sv);
} else if (strcmp(sentence, "GPRMC") == 0) {
@@ -369,7 +366,7 @@ int nmea_parser(char *data, pos_data_t * pos, sv_data_t * sv)
if (err == READ_NOT_FIXED) {
LOG_PLUGIN(DBG_LOW, "NOT Fixed");
ret = err;
- } else if (ret == READ_ERROR) {
+ } else if (err == READ_ERROR) {
ret = err;
break;
}