소스 검색

heteroprio: correct memory allocation to avoid leak

Ludovic PAILLAT 3 년 전
부모
커밋
66ba21c539
1개의 변경된 파일1개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 3
      src/sched_policies/heteroprio.c

+ 1 - 3
src/sched_policies/heteroprio.c

@@ -1010,8 +1010,8 @@ static void starpu_autoheteroprio_add_task(struct _starpu_heteroprio_data *hp, c
 	check_heteroprio_mapping(hp); // ensures that priorities are correctly mapped
 }
 
-static char *_heteroprio_data_dir = NULL;
 #define _HETEROPRIO_DIR_MAXLEN 256
+static char _heteroprio_data_dir[_HETEROPRIO_DIR_MAXLEN];
 
 /* Try to get the name of the program, to get specific data file for each program */
 #ifdef STARPU_HAVE_PROGRAM_INVOCATION_SHORT_NAME
@@ -1026,8 +1026,6 @@ static char *_starpu_heteroprio_get_data_dir()
 
 	if(!directory_existence_was_tested)
 	{
-		_STARPU_MALLOC(_heteroprio_data_dir, _HETEROPRIO_DIR_MAXLEN);
-
 		char *path = starpu_getenv("STARPU_HETEROPRIO_DATA_DIR");
 		if(path)
 		{