diff options
author | woglinde <woglinde@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2014-08-09 23:51:17 +0000 |
---|---|---|
committer | woglinde <woglinde@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2014-08-09 23:51:17 +0000 |
commit | 433339c212ef7b9747bf894d6845a445010a35ae (patch) | |
tree | 0a39728665345163ef16e950f5ccd68771c5747e /navit/map | |
parent | 49d603ed4121d8630eb539a167897578f0ebca74 (diff) | |
download | navit-433339c212ef7b9747bf894d6845a445010a35ae.tar.gz |
Fix:map_csv:Fix do not evaluate pointers before null check, found by coverity
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5854 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/map')
-rw-r--r-- | navit/map/csv/csv.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/navit/map/csv/csv.c b/navit/map/csv/csv.c index 3ad5893c6..8ac279321 100644 --- a/navit/map/csv/csv.c +++ b/navit/map/csv/csv.c @@ -278,17 +278,22 @@ csv_attr_get(void *priv_data, enum attr_type attr_type, struct attr *attr) static int csv_attr_set(void *priv_data, struct attr *attr, enum change_mode mode) { - struct map_rect_priv* mr = (struct map_rect_priv*)priv_data; - struct map_priv* m = mr->m; - int i, bFound = 0; + struct map_rect_priv* mr; + struct map_priv* m; + int i, bFound; struct attr *attr_new; GList *attr_list, *curr_attr_list; - enum attr_type *at = m->attr_types; + enum attr_type *at; - if(!mr || !mr->qitem) { + mr = (struct map_rect_priv*)priv_data; + if(!mr || !mr->qitem) { return 0; } + m = mr->m; + bFound = 0; + at = m->attr_types; + /*if attribute is not supported by this csv map return 0*/ for(i=0;i<m->attr_cnt;++i) { if(*at==attr->type) { |