From: Paul Floyd Date: Tue, 21 Nov 2023 20:58:36 +0000 (+0100) Subject: mpi: remove NULL checks before frees X-Git-Tag: VALGRIND_3_23_0~247 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=89da13e73139d4bbaa5eaa8e83a8a9e9ff30e2c8;p=thirdparty%2Fvalgrind.git mpi: remove NULL checks before frees As Coverity points out, paths reaching these NULL checks will have already dereferenced the pointers. So use the same condition as for the allocation. --- diff --git a/mpi/libmpiwrap.c b/mpi/libmpiwrap.c index df0a1ae9df..24221f8108 100644 --- a/mpi/libmpiwrap.c +++ b/mpi/libmpiwrap.c @@ -869,9 +869,15 @@ void walk_type ( void(*f)(void*,long), char* base, MPI_Datatype ty ) } /* normal exit */ - if (ints) free(ints); - if (addrs) free(addrs); - if (dtys) free(dtys); + if (n_ints > 0) { + free(ints); + } + if (n_addrs > 0) { + free(addrs); + } + if (n_dtys) { + free(dtys); + } return; unhandled: