prepare for the release of rrdtool-1.2.16
[rrdtool.git] / src / rrd_create.c
index 1200b53..378f636 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.2.11  Copyright by Tobi Oetiker, 1997-2005
+ * RRDtool 1.2.16  Copyright by Tobi Oetiker, 1997-2006
  *****************************************************************************
  * rrd_create.c  creates new rrds
  *****************************************************************************/
@@ -78,7 +78,10 @@ rrd_create(int argc, char **argv)
            return(-1);
        }
     }
-
+    if (optind == argc) {
+         rrd_set_error("what is the name of the rrd file you want to create?");
+         return -1;
+    }
     rc = rrd_create_r(argv[optind],
                      pdp_step, last_up,
                      argc - optind - 1, argv + optind + 1);
@@ -554,8 +557,11 @@ rrd_create_fn(char *file_name, rrd_t *rrd)
     if ((rrd_file = fopen(file_name,"wb")) == NULL ) {
        rrd_set_error("creating '%s': %s",file_name, rrd_strerror(errno));
        free(rrd->stat_head);
+        rrd->stat_head = NULL; 
        free(rrd->ds_def);
+        rrd->ds_def = NULL; 
        free(rrd->rra_def);
+        rrd->rra_def = NULL;
        return(-1);
     }