Procházet zdrojové kódy

test sam: Free temp str allocated by cmap

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Jan Friesse před 12 roky
rodič
revize
5c7911b4d9
2 změnil soubory, kde provedl 27 přidání a 0 odebrání
  1. 13 0
      cts/agents/sam_test_agent.c
  2. 14 0
      test/testsam.c

+ 13 - 0
cts/agents/sam_test_agent.c

@@ -808,6 +808,7 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "quit") != 0) {
 		if (strcmp(str, "quit") != 0) {
 			qb_log (LOG_INFO, "Recovery key \"%s\" is not \"quit\".", key_name);
 			qb_log (LOG_INFO, "Recovery key \"%s\" is not \"quit\".", key_name);
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
 		free(str);
 		free(str);
@@ -821,6 +822,7 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "stopped") != 0) {
 		if (strcmp(str, "stopped") != 0) {
 			qb_log (LOG_INFO, "State key is not \"stopped\".");
 			qb_log (LOG_INFO, "State key is not \"stopped\".");
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
 		free(str);
 		free(str);
@@ -840,6 +842,7 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "running") != 0) {
 		if (strcmp(str, "running") != 0) {
 			qb_log (LOG_INFO, "State key is not \"running\".");
 			qb_log (LOG_INFO, "State key is not \"running\".");
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
 		free(str);
 		free(str);
@@ -859,6 +862,7 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "stopped") != 0) {
 		if (strcmp(str, "stopped") != 0) {
 			qb_log (LOG_INFO, "State key is not \"stopped\".");
 			qb_log (LOG_INFO, "State key is not \"stopped\".");
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
 		free(str);
 		free(str);
@@ -874,6 +878,7 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "stopped") != 0) {
 		if (strcmp(str, "stopped") != 0) {
 			qb_log (LOG_INFO, "State key is not \"stopped\".");
 			qb_log (LOG_INFO, "State key is not \"stopped\".");
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
 		free(str);
 		free(str);
@@ -893,6 +898,7 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "running") != 0) {
 		if (strcmp(str, "running") != 0) {
 			qb_log (LOG_INFO, "State key is not \"running\".");
 			qb_log (LOG_INFO, "State key is not \"running\".");
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
 		free(str);
 		free(str);
@@ -952,6 +958,7 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 			if (strcmp(str, "stopped") != 0) {
 			if (strcmp(str, "stopped") != 0) {
 				qb_log (LOG_INFO, "State key is not \"stopped\".");
 				qb_log (LOG_INFO, "State key is not \"stopped\".");
+				free(str);
 				return (2);
 				return (2);
 			}
 			}
 			free(str);
 			free(str);
@@ -977,8 +984,10 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "failed") != 0) {
 		if (strcmp(str, "failed") != 0) {
 			qb_log (LOG_INFO, "State key is not \"failed\".");
 			qb_log (LOG_INFO, "State key is not \"failed\".");
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
+		free(str);
 
 
 		return (0);
 		return (0);
 	}
 	}
@@ -1030,6 +1039,7 @@ static int test9 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 			if (strcmp(str, "restart") != 0) {
 			if (strcmp(str, "restart") != 0) {
 				qb_log (LOG_INFO, "Recovery key \"%s\" is not \"restart\".", str);
 				qb_log (LOG_INFO, "Recovery key \"%s\" is not \"restart\".", str);
+				free(str);
 				return (2);
 				return (2);
 			}
 			}
 			free(str);
 			free(str);
@@ -1043,6 +1053,7 @@ static int test9 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 			if (strcmp(str, "stopped") != 0) {
 			if (strcmp(str, "stopped") != 0) {
 				qb_log (LOG_INFO, "State key is not \"stopped\".");
 				qb_log (LOG_INFO, "State key is not \"stopped\".");
+				free(str);
 				return (2);
 				return (2);
 			}
 			}
 			free(str);
 			free(str);
@@ -1062,6 +1073,7 @@ static int test9 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 			if (strcmp(str, "running") != 0) {
 			if (strcmp(str, "running") != 0) {
 				qb_log (LOG_INFO, "State key is not \"running\".");
 				qb_log (LOG_INFO, "State key is not \"running\".");
+				free(str);
 				return (2);
 				return (2);
 			}
 			}
 			free(str);
 			free(str);
@@ -1103,6 +1115,7 @@ static int test9 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "failed") != 0) {
 		if (strcmp(str, "failed") != 0) {
 			qb_log (LOG_INFO, "State key is not \"failed\".");
 			qb_log (LOG_INFO, "State key is not \"failed\".");
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
 		free(str);
 		free(str);

+ 14 - 0
test/testsam.c

@@ -768,6 +768,7 @@ static int test7 (void) {
 	}
 	}
         if (strcmp(str, "testquorum") != 0) {
         if (strcmp(str, "testquorum") != 0) {
 		printf ("Provider is not testquorum. Test skipped\n");
 		printf ("Provider is not testquorum. Test skipped\n");
+		free(str);
 		return (1);
 		return (1);
         }
         }
 	free(str);
 	free(str);
@@ -911,6 +912,7 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "quit") != 0) {
 		if (strcmp(str, "quit") != 0) {
 			printf ("Recovery key \"%s\" is not \"quit\".\n", key_name);
 			printf ("Recovery key \"%s\" is not \"quit\".\n", key_name);
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
 		free(str);
 		free(str);
@@ -924,6 +926,7 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "stopped") != 0) {
 		if (strcmp(str, "stopped") != 0) {
 			printf ("State key is not \"stopped\".\n");
 			printf ("State key is not \"stopped\".\n");
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
 		free(str);
 		free(str);
@@ -943,6 +946,7 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "running") != 0) {
 		if (strcmp(str, "running") != 0) {
 			printf ("State key is not \"running\".\n");
 			printf ("State key is not \"running\".\n");
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
 		free(str);
 		free(str);
@@ -962,6 +966,7 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "stopped") != 0) {
 		if (strcmp(str, "stopped") != 0) {
 			printf ("State key is not \"stopped\".\n");
 			printf ("State key is not \"stopped\".\n");
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
 		free(str);
 		free(str);
@@ -977,6 +982,7 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "stopped") != 0) {
 		if (strcmp(str, "stopped") != 0) {
 			printf ("State key is not \"stopped\".\n");
 			printf ("State key is not \"stopped\".\n");
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
 		free(str);
 		free(str);
@@ -996,6 +1002,7 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "running") != 0) {
 		if (strcmp(str, "running") != 0) {
 			printf ("State key is not \"running\".\n");
 			printf ("State key is not \"running\".\n");
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
 		free(str);
 		free(str);
@@ -1055,6 +1062,7 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 			if (strcmp(str, "stopped") != 0) {
 			if (strcmp(str, "stopped") != 0) {
 				printf ("State key is not \"stopped\".\n");
 				printf ("State key is not \"stopped\".\n");
+				free(str);
 				return (2);
 				return (2);
 			}
 			}
 			free(str);
 			free(str);
@@ -1080,8 +1088,10 @@ static int test8 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "failed") != 0) {
 		if (strcmp(str, "failed") != 0) {
 			printf ("State key is not \"failed\".\n");
 			printf ("State key is not \"failed\".\n");
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
+		free(str);
 
 
 		return (0);
 		return (0);
 	}
 	}
@@ -1133,6 +1143,7 @@ static int test9 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 			if (strcmp(str, "restart") != 0) {
 			if (strcmp(str, "restart") != 0) {
 				printf ("Recovery key \"%s\" is not \"restart\".\n", str);
 				printf ("Recovery key \"%s\" is not \"restart\".\n", str);
+				free(str);
 				return (2);
 				return (2);
 			}
 			}
 			free(str);
 			free(str);
@@ -1146,6 +1157,7 @@ static int test9 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 			if (strcmp(str, "stopped") != 0) {
 			if (strcmp(str, "stopped") != 0) {
 				printf ("State key is not \"stopped\".\n");
 				printf ("State key is not \"stopped\".\n");
+				free(str);
 				return (2);
 				return (2);
 			}
 			}
 			free(str);
 			free(str);
@@ -1165,6 +1177,7 @@ static int test9 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 			if (strcmp(str, "running") != 0) {
 			if (strcmp(str, "running") != 0) {
 				printf ("State key is not \"running\".\n");
 				printf ("State key is not \"running\".\n");
+				free(str);
 				return (2);
 				return (2);
 			}
 			}
 			free(str);
 			free(str);
@@ -1210,6 +1223,7 @@ static int test9 (pid_t pid, pid_t old_pid, int test_n) {
 
 
 		if (strcmp(str, "failed") != 0) {
 		if (strcmp(str, "failed") != 0) {
 			printf ("State key is not \"failed\".\n");
 			printf ("State key is not \"failed\".\n");
+			free(str);
 			return (2);
 			return (2);
 		}
 		}
 		free(str);
 		free(str);