diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-18 16:26:14 +0100 |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2025-03-18 16:26:14 +0100 |
commit | a0710dbd72ea6314cf6a1ec50d2fa3c3c0543748 (patch) | |
tree | a5dff4424a9d48f659e56810935a27dd45e82c53 /plugins | |
parent | 42531fa92a97318f2b96265f501f37e7fd96ea4c (diff) | |
download | monitoring-plugins-a0710dbd72ea6314cf6a1ec50d2fa3c3c0543748.tar.gz |
check_disk: Remove unnecessary NULL checks
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_disk.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 15ec06cd..050298d6 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c | |||
@@ -878,34 +878,22 @@ void set_all_thresholds(struct parameter_list *path, char *warn_freespace_units, | |||
878 | char *crit_freespace_percent, char *warn_usedspace_units, char *crit_usedspace_units, char *warn_usedspace_percent, | 878 | char *crit_freespace_percent, char *warn_usedspace_units, char *crit_usedspace_units, char *warn_usedspace_percent, |
879 | char *crit_usedspace_percent, char *warn_usedinodes_percent, char *crit_usedinodes_percent, | 879 | char *crit_usedspace_percent, char *warn_usedinodes_percent, char *crit_usedinodes_percent, |
880 | char *warn_freeinodes_percent, char *crit_freeinodes_percent) { | 880 | char *warn_freeinodes_percent, char *crit_freeinodes_percent) { |
881 | if (path->freespace_units != NULL) { | 881 | free(path->freespace_units); |
882 | free(path->freespace_units); | ||
883 | } | ||
884 | set_thresholds(&path->freespace_units, warn_freespace_units, crit_freespace_units); | 882 | set_thresholds(&path->freespace_units, warn_freespace_units, crit_freespace_units); |
885 | 883 | ||
886 | if (path->freespace_percent != NULL) { | 884 | free(path->freespace_percent); |
887 | free(path->freespace_percent); | ||
888 | } | ||
889 | set_thresholds(&path->freespace_percent, warn_freespace_percent, crit_freespace_percent); | 885 | set_thresholds(&path->freespace_percent, warn_freespace_percent, crit_freespace_percent); |
890 | 886 | ||
891 | if (path->usedspace_units != NULL) { | 887 | free(path->usedspace_units); |
892 | free(path->usedspace_units); | ||
893 | } | ||
894 | set_thresholds(&path->usedspace_units, warn_usedspace_units, crit_usedspace_units); | 888 | set_thresholds(&path->usedspace_units, warn_usedspace_units, crit_usedspace_units); |
895 | 889 | ||
896 | if (path->usedspace_percent != NULL) { | 890 | free(path->usedspace_percent); |
897 | free(path->usedspace_percent); | ||
898 | } | ||
899 | set_thresholds(&path->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent); | 891 | set_thresholds(&path->usedspace_percent, warn_usedspace_percent, crit_usedspace_percent); |
900 | 892 | ||
901 | if (path->usedinodes_percent != NULL) { | 893 | free(path->usedinodes_percent); |
902 | free(path->usedinodes_percent); | ||
903 | } | ||
904 | set_thresholds(&path->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent); | 894 | set_thresholds(&path->usedinodes_percent, warn_usedinodes_percent, crit_usedinodes_percent); |
905 | 895 | ||
906 | if (path->freeinodes_percent != NULL) { | 896 | free(path->freeinodes_percent); |
907 | free(path->freeinodes_percent); | ||
908 | } | ||
909 | set_thresholds(&path->freeinodes_percent, warn_freeinodes_percent, crit_freeinodes_percent); | 897 | set_thresholds(&path->freeinodes_percent, warn_freeinodes_percent, crit_freeinodes_percent); |
910 | } | 898 | } |
911 | 899 | ||