From 9896ed828af404a1e8d974f8767bbea60b66ed9a Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Tue, 2 Apr 2013 10:39:30 -0700 Subject: [PATCH 1/3] Add #includes for OpenBSD Add includes for and to rtp.c and rtsp.c, needed for the declarations of IPPROTO_TCP, IPV6_V6ONLY, and others. --- rtp.c | 2 ++ rtsp.c | 1 + 2 files changed, 3 insertions(+) diff --git a/rtp.c b/rtp.c index 30803050..e1b96d7d 100644 --- a/rtp.c +++ b/rtp.c @@ -28,7 +28,9 @@ #include #include #include +#include #include +#include #include #include "common.h" #include "player.h" diff --git a/rtsp.c b/rtsp.c index 2f6d59d9..011ed0f4 100644 --- a/rtsp.c +++ b/rtsp.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include From a6f48e8d53e59b0196f3ed698c9eee2852aa714d Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Tue, 2 Apr 2013 11:00:00 -0700 Subject: [PATCH 2/3] Define AI_ADDRCONFIG (needed for OpenBSD and NetBSD) AI_ADDRCONFIG is not supported by some BSDs (OpenBSD and NetBSD). It's not a critical flag, so define it to 0 just to fix the compile error. --- rtsp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rtsp.c b/rtsp.c index 011ed0f4..421dd2c0 100644 --- a/rtsp.c +++ b/rtsp.c @@ -45,6 +45,12 @@ #include "rtp.h" #include "mdns.h" +// some BSDs (OpenBSD, NetBSD) do not support AI_ADDRCONFIG +// it's not critical anyway, define it to 0 (a no-op) +#ifndef AI_ADDRCONFIG +#define AI_ADDRCONFIG 0 +#endif + // only one thread is allowed to use the player at once. // it monitors the request variable (at least when interrupted) static pthread_mutex_t playing_mutex = PTHREAD_MUTEX_INITIALIZER; From 883d462192ce4d4057969db2769c7a0fda27807c Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Wed, 3 Apr 2013 08:53:53 -0700 Subject: [PATCH 3/3] Call freeaddrinfo() in rtp.c Plug a (small) memory leak from getaddrinfo() --- rtp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rtp.c b/rtp.c index 978b96b9..beea88e2 100644 --- a/rtp.c +++ b/rtp.c @@ -104,6 +104,8 @@ static int bind_port(SOCKADDR *remote) { sock = socket(remote->SAFAMILY, SOCK_DGRAM, IPPROTO_UDP); ret = bind(sock, info->ai_addr, info->ai_addrlen); + freeaddrinfo(info); + if (ret < 0) die("could not bind a UDP port!");