Browse Source

v.out.lidar: check the right variable for null

Fixes Coverity CID 1341834.


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@67153 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 9 years ago
parent
commit
38286bbbab
1 changed files with 3 additions and 7 deletions
  1. 3 7
      vector/v.out.lidar/main.c

+ 3 - 7
vector/v.out.lidar/main.c

@@ -71,19 +71,15 @@ struct LidarColumnNames
 static void open_database(struct Map_info *vector, int field,
 static void open_database(struct Map_info *vector, int field,
                           dbDriver ** driver, struct field_info **f_info)
                           dbDriver ** driver, struct field_info **f_info)
 {
 {
-    struct field_info *f_info_tmp;
-
-    f_info_tmp = Vect_get_field(vector, field);
-    dbDriver *driver_tmp;
-
-    if (f_info == NULL) {
+    struct field_info *f_info_tmp = Vect_get_field(vector, field);
+    if (f_info_tmp == NULL) {
         /* not ideal message since we don't know the original name of
         /* not ideal message since we don't know the original name of
          * the field in case of OGR */
          * the field in case of OGR */
         G_fatal_error(_("Database connection not defined for layer <%d>"),
         G_fatal_error(_("Database connection not defined for layer <%d>"),
                       field);
                       field);
     }
     }
 
 
-    driver_tmp =
+    dbDriver *driver_tmp =
         db_start_driver_open_database(f_info_tmp->driver,
         db_start_driver_open_database(f_info_tmp->driver,
                                       f_info_tmp->database);
                                       f_info_tmp->database);
     if (driver_tmp == NULL)
     if (driver_tmp == NULL)