[PATCH] covoar: Fix null pointer dereference

Gedare Bloom gedare at rtems.org
Mon Mar 15 20:26:39 UTC 2021


ok -- imagine that, cleaning up resources in a destructor ;)

On Fri, Mar 12, 2021 at 10:06 AM Alex White <alex.white at oarcorp.com> wrote:
>
> A null pointer dereference happens later in the program execution if
> the files are cleaned up at the end of the ExecutableInfo constructor.
> This change fixes the null pointer dereference.
> ---
>  tester/covoar/ExecutableInfo.cc | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/tester/covoar/ExecutableInfo.cc b/tester/covoar/ExecutableInfo.cc
> index 1396519..187bb77 100644
> --- a/tester/covoar/ExecutableInfo.cc
> +++ b/tester/covoar/ExecutableInfo.cc
> @@ -82,13 +82,16 @@ namespace Coverage {
>        throw;
>      }
>
> -    debug.end();
> -    executable.end();
> -    executable.close();
> +    // Can't cleanup handles until the destructor because the information is
> +    // referenced elsewhere. NOTE: This could cause problems from too many open
> +    // file descriptors.
>    }
>
>    ExecutableInfo::~ExecutableInfo()
>    {
> +    debug.end();
> +    executable.end();
> +    executable.close();
>    }
>
>    void ExecutableInfo::dumpCoverageMaps( void ) {
> --
> 2.27.0
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list