Sfoglia il codice sorgente

Fix a memory leak in starpu_codelet_pack_args.

Cyril Roelandt 13 anni fa
parent
commit
8a9eb4307b
2 ha cambiato i file con 7 aggiunte e 1 eliminazioni
  1. 2 0
      src/util/starpu_insert_task.c
  2. 5 1
      tests/core/insert_task.c

+ 2 - 0
src/util/starpu_insert_task.c

@@ -60,6 +60,8 @@ void starpu_codelet_unpack_args(void *_cl_arg, ...)
 	}
 
 	va_end(varg_list);
+
+	free(cl_arg);
 }
 
 int starpu_insert_task(struct starpu_codelet *cl, ...)

+ 5 - 1
tests/core/insert_task.c

@@ -20,7 +20,11 @@
 
 void func_cpu(void *descr[], void *_args)
 {
-	STARPU_SKIP_IF_VALGRIND;
+	/*
+	 * Do not use STARPU_SKIP_IF_VALGRIND here.
+	 * We need to call starpu_codelet_unpack_args() in order to make sure
+	 * there are no memory leaks in the program.
+	 */
 
 	int *x0 = (int *)STARPU_VARIABLE_GET_PTR(descr[0]);
 	float *x1 = (float *)STARPU_VARIABLE_GET_PTR(descr[1]);