Jelajahi Sumber

Allocate region before use

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@34285 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 16 tahun lalu
induk
melakukan
7b3dcfb955
1 mengubah file dengan 3 tambahan dan 2 penghapusan
  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");
   }