浏览代码

Allocate region before use

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@34285 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 16 年之前
父节点
当前提交
7b3dcfb955
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      raster/r.terraflow/main.cc

+ 3 - 2
raster/r.terraflow/main.cc

@@ -455,12 +455,13 @@ main(int argc, char *argv[]) {
   opt = (userOptions*)malloc(sizeof(userOptions));
   assert(opt);
   
+  region = (struct Cell_head*)malloc(sizeof(struct Cell_head));
+  assert(region);
+
   parse_args(argc, argv);
   check_args();
 
   /* get the current region and dimensions */  
-  region = (struct Cell_head*)malloc(sizeof(struct Cell_head));
-  assert(region);
   if (G_get_set_window(region) == -1) {
     G_fatal_error("r.terraflow: error getting current region");
   }