Ver código fonte

lib/utils_base.c - resource leaks

On error, set_thresholds was not freeing before returning.

coverity 103717 & 103717#2
Spenser Reinhardt 11 anos atrás
pai
commit
b618bb4cbd
1 arquivos alterados com 2 adições e 0 exclusões
  1. 2 0
      lib/utils_base.c

+ 2 - 0
lib/utils_base.c

@@ -167,11 +167,13 @@ _set_thresholds(thresholds **my_thresholds, char *warn_string, char *critical_st
 
 	if (warn_string) {
 		if (!(temp_thresholds->warning = parse_range_string(warn_string))) {
+			free(temp_thresholds);
 			return NP_RANGE_UNPARSEABLE;
 		}
 	}
 	if (critical_string) {
 		if (!(temp_thresholds->critical = parse_range_string(critical_string))) {
+			free(temp_thresholds);
 			return NP_RANGE_UNPARSEABLE;
 		}
 	}