meta-openembedded/meta-networking/recipes-protocols/mdns/files/0011-Change-a-dynamic-allocation-to-file-scope-variable.patch
Mikko Rapeli 21afab4609 mdns: update to version 1096.40.7
Refresh Makefile patch (build.patch) to properly cross compile
mdns. Then try refresh patches which still apply. Following patches
don't apply anymore due to refactoring done on mdns side so thus
dropping patches:

 * 0005-Handle-noisy-netlink-sockets.patch
 * 0007-Indicate-loopback-interface-to-mDNS-core.patch

Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2020-09-08 11:53:53 -07:00

54 lines
1.9 KiB
Diff

From 9ff06108cd44e84ba6c68bfa6737e793f117e303 Mon Sep 17 00:00:00 2001
From: Nate Karstens <nate.karstens@garmin.com>
Date: Thu, 10 Aug 2017 08:46:03 -0500
Subject: [PATCH] Change a dynamic allocation to file-scope variable
Changes a variable from being dynamically-allocated to being
statically-allocated at the file scope. Addresses a Coverity
issue where it appeared that the memory was being leaked.
Upstream-Status: Submitted [dts@apple.com]
Signed-off-by: Nate Karstens <nate.karstens@garmin.com>
---
mDNSPosix/mDNSPosix.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c
index 7aeee7b..2d25016 100755
--- a/mDNSPosix/mDNSPosix.c
+++ b/mDNSPosix/mDNSPosix.c
@@ -81,6 +81,7 @@ static sigset_t gEventSignalSet; // Signals which event loop list
static sigset_t gEventSignals; // Signals which were received while inside loop
static PosixNetworkInterface *gRecentInterfaces;
+static IfChangeRec gChgRec;
// ***************************************************************************
// Globals (for debugging)
@@ -1641,18 +1642,11 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context)
mDNSlocal mStatus WatchForInterfaceChange(mDNS *const m)
{
mStatus err;
- IfChangeRec *pChgRec;
- pChgRec = (IfChangeRec*) mDNSPlatformMemAllocateClear(sizeof *pChgRec);
- if (pChgRec == NULL)
- return mStatus_NoMemoryErr;
-
- pChgRec->mDNS = m;
- err = OpenIfNotifySocket(&pChgRec->NotifySD);
+ gChgRec.mDNS = m;
+ err = OpenIfNotifySocket(&gChgRec.NotifySD);
if (err == 0)
- err = mDNSPosixAddFDToEventLoop(pChgRec->NotifySD, InterfaceChangeCallback, pChgRec);
- if (err)
- mDNSPlatformMemFree(pChgRec);
+ err = mDNSPosixAddFDToEventLoop(gChgRec.NotifySD, InterfaceChangeCallback, &gChgRec);
return err;
}
--
2.20.1