Add some free

This commit is contained in:
Raffaele Mignone 2021-03-26 18:07:43 +01:00
parent 84cf48c37e
commit faa7e072b5
Signed by: norangebit
GPG Key ID: F5255658CB220573
2 changed files with 7 additions and 0 deletions

5
main.c
View File

@ -49,6 +49,9 @@ int main() {
distribute_text();
if (rank == MASTER)
free(text);
//printf("%d -> input: %s\n", rank, private_text);
//printf("%d -> text len: %d\n", rank, private_text_len);
@ -66,6 +69,8 @@ int main() {
search_for_splitted_pattern(&residue, &match_number, &matches);
free(private_text);
calculate_absolute_indices(match_number, matches);
//printf("%d -> result number: %d\n", rank, match_number);

View File

@ -2,6 +2,7 @@
#include "kmp.h"
#include <stdio.h>
#include <papi.h>
#include <malloc.h>
int main() {
int text_len, pattern_len;
@ -18,6 +19,7 @@ int main() {
long_long start_search = PAPI_get_real_usec();
int *matches = search_pattern(text, pattern, lps, &match_number, &residue);
free(text);
long_long end_time = PAPI_get_real_usec();
printf("found %d matches\n", match_number);