Code

prepare for the release of rrdtool-1.2.30
[rrdtool.git] / src / rrd_cgi.c
index 8156b203267af5612b59d329d02ea4be888f4c2f..1c5d6e48fb21234e0e9832976f4041a65af245a6 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * RRDtool 1.2.14  Copyright by Tobi Oetiker, 1997-2006
+ * RRDtool 1.2.30  Copyright by Tobi Oetiker, 1997-2009
  *****************************************************************************
  * rrd_cgi.c  RRD Web Page Generator
  *****************************************************************************/
@@ -305,6 +305,7 @@ static void calfree (void){
     if (calcpr) {
            free(calcpr);
     }
+    calcpr=NULL;
   }
 }
 
@@ -574,7 +575,7 @@ char* printstrftime(long argc, const char **args){
        /* Make sure that we were given the right number of args */
        if( argc != 4) {
                rrd_set_error( "wrong number of args %d", argc);
-               return (char *) -1;
+               return stralloc("");
        }
 
        /* Init start and end time */
@@ -584,14 +585,14 @@ char* printstrftime(long argc, const char **args){
        /* Parse the start and end times we were given */
        if( (parsetime_error = parsetime( args[1], &start_tv))) {
                rrd_set_error( "start time: %s", parsetime_error);
-               return (char *) -1;
+               return stralloc("");
        }
        if( (parsetime_error = parsetime( args[2], &end_tv))) {
                rrd_set_error( "end time: %s", parsetime_error);
-               return (char *) -1;
+               return stralloc("");
        }
        if( proc_start_end( &start_tv, &end_tv, &start_tmp, &end_tmp) == -1) {
-               return (char *) -1;
+               return stralloc("");
        }
 
        /* Do we do the start or end */
@@ -603,7 +604,7 @@ char* printstrftime(long argc, const char **args){
        }
        else {
                rrd_set_error( "start/end not found in '%s'", args[0]);
-               return (char *) -1;
+               return stralloc("");
        }
 
        /* now format it */
@@ -612,7 +613,7 @@ char* printstrftime(long argc, const char **args){
        }
        else {
                rrd_set_error( "strftime failed");
-               return (char *) -1;
+               return stralloc("");
        }
 }
 
@@ -778,7 +779,6 @@ char* drawgraph(long argc, const char **args){
       char *err = malloc((strlen(rrd_get_error())+DS_NAM_SIZE)*sizeof(char));
       sprintf(err, "[ERROR: %s]",rrd_get_error());
       rrd_clear_error();
-      calfree();
       return err;
     }
   }
@@ -1287,7 +1287,7 @@ s_var **rrdcgiReadVariables(void)
        if (i<numargs) {
 
            /* try to find out if there's already such a variable */
-           for (k=0; k<i && (strncmp (result[k]->name,cp, esp-cp) || !(strlen (result[k]->name) == esp-cp)); k++);
+           for (k=0; k<i && (strncmp (result[k]->name,cp, esp-cp) || !(strlen (result[k]->name) == (size_t)(esp-cp))); k++);
 
            if (k == i) {       /* No such variable yet */
                if ((result[i] = (s_var *)malloc(sizeof(s_var))) == NULL)