From 2e23d01b603f7e9e970e9b8a85deada4c5713e2a Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 5 May 2016 20:07:48 +0200 Subject: [PATCH] Systemlib: harden perf counter handling for null ptrs --- src/modules/systemlib/perf_counter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/systemlib/perf_counter.c b/src/modules/systemlib/perf_counter.c index be75ea2368..f6bf513044 100644 --- a/src/modules/systemlib/perf_counter.c +++ b/src/modules/systemlib/perf_counter.c @@ -1,6 +1,6 @@ /**************************************************************************** * - * Copyright (C) 2012-2016 PX4 Development Team. All rights reserved. + * Copyright (c) 2012-2016 PX4 Development Team. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -419,6 +419,10 @@ perf_reset(perf_counter_t handle) void perf_print_counter(perf_counter_t handle) { + if (handle == NULL) { + return; + } + perf_print_counter_fd(1, handle); }