Code

set_thresholds now let the user free the thresolds. (P.S.: When you set twice the...
authorThomas Guyot-Sionnest <dermoth@users.sourceforge.net>
Wed, 13 Feb 2008 11:05:44 +0000 (11:05 +0000)
committerThomas Guyot-Sionnest <dermoth@users.sourceforge.net>
Wed, 13 Feb 2008 11:05:44 +0000 (11:05 +0000)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1930 f882894a-f735-0410-b71e-b25c423dba1c

lib/utils_base.c
plugins/check_disk.c

index c0bc4dc55de583d8a23fa5a9c585077f2c36116c..a36eb68082fb13d7f866b4109df9d7e318e351eb 100644 (file)
@@ -120,10 +120,6 @@ _set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_st
                }
        }
 
-       if (*my_thresholds > 0) {       /* Not sure why, but sometimes could be -1 */
-               /* printf("Freeing here: %d\n", *my_thresholds); */
-               free(*my_thresholds);
-       }
        *my_thresholds = temp_thresholds;
 
        return 0;
index 363879c63143e3d165bf8eb8b999d2789e2fd9c4..29aec6296ecb32ee6f5780414afe6385e6b301ca 100644 (file)
@@ -688,7 +688,7 @@ process_arguments (int argc, char **argv)
                printf("ignoring %s matching regex\n", temp_list->name);
 
               temp_list = np_del_parameter(temp_list, previous);
-              /* pointer to first element needs to be uüdated if first item gets deleted */
+              /* pointer to first element needs to be updated if first item gets deleted */
               if (previous == NULL)
                 path_select_list = temp_list;
           } else {
@@ -828,11 +828,17 @@ print_path (const char *mypath)
 void
 set_all_thresholds (struct parameter_list *path) 
 {
+               if (path->freespace_units != NULL) free(path->freespace_units);
     set_thresholds(&path->freespace_units, warn_freespace_units, crit_freespace_units);
+               if (path->freespace_percent != NULL) free (path->freespace_percent);
     set_thresholds(&path->freespace_percent, warn_freespace_percent, crit_freespace_percent);
+               if (path->usedspace_units != NULL) free (path->usedspace_units);
     set_thresholds(&path->usedspace_units, warn_usedspace_units, crit_usedspace_units);
+               if (path->usedspace_percent != NULL) free (path->usedspace_percent);
     set_thresholds(&path->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent);
+               if (path->usedinodes_percent != NULL) free (path->usedinodes_percent);
     set_thresholds(&path->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent);
+               if (path->freeinodes_percent != NULL) free (path->freeinodes_percent);
     set_thresholds(&path->freeinodes_percent, warn_freeinodes_percent, crit_freeinodes_percent);
 }