diff mbox series

[FFmpeg-devel] timer: don't leak perf FD if zero

Message ID 20230719171620.22045-1-remi@remlab.net
State Accepted
Commit c644aabec8e1144ca5646dc7da2583dd82092119
Headers show
Series [FFmpeg-devel] timer: don't leak perf FD if zero | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Rémi Denis-Courmont July 19, 2023, 5:16 p.m. UTC
---
 libavutil/timer.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavutil/timer.h b/libavutil/timer.h
index 861ba7e9d7..2cd299eca3 100644
--- a/libavutil/timer.h
+++ b/libavutil/timer.h
@@ -105,9 +105,9 @@ 
 #if CONFIG_LINUX_PERF
 
 #define START_TIMER                                                         \
-    static int linux_perf_fd;                                               \
+    static int linux_perf_fd = -1;                                          \
     uint64_t tperf;                                                         \
-    if (!linux_perf_fd) {                                                   \
+    if (linux_perf_fd == -1) {                                              \
         struct perf_event_attr attr = {                                     \
             .type           = PERF_TYPE_HARDWARE,                           \
             .size           = sizeof(struct perf_event_attr),               \