From 40905ec6bb35f480ebd603301576da7a339c1d95 Mon Sep 17 00:00:00 2001 From: Mariusz Zaborski Date: Thu, 4 Jan 2018 08:23:23 +0000 Subject: [PATCH] cap_unwrap should return a descriptor but also free the structure. --- lib/libcasper/libcasper/libcasper.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/libcasper/libcasper/libcasper.h b/lib/libcasper/libcasper/libcasper.h index 8ad15bc6510..a75017058ab 100644 --- a/lib/libcasper/libcasper/libcasper.h +++ b/lib/libcasper/libcasper/libcasper.h @@ -122,7 +122,15 @@ cap_wrap(int sock) #ifdef WITH_CASPER int cap_unwrap(cap_channel_t *chan); #else -#define cap_unwrap(chan) (chan->cch_fd) +static inline int +cap_unwrap(cap_channel_t *chan) +{ + int fd; + + fd = chan->cch_fd; + free(chan); + return (fd); +} #endif /*