diff options
Diffstat (limited to 'meta-networking/recipes-protocols/mdns/mdns/0011-Change-a-dynamic-allocation-to-file-scope-variable.patch')
-rw-r--r-- | meta-networking/recipes-protocols/mdns/mdns/0011-Change-a-dynamic-allocation-to-file-scope-variable.patch | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/mdns/mdns/0011-Change-a-dynamic-allocation-to-file-scope-variable.patch b/meta-networking/recipes-protocols/mdns/mdns/0011-Change-a-dynamic-allocation-to-file-scope-variable.patch new file mode 100644 index 000000000..d9adde04c --- /dev/null +++ b/meta-networking/recipes-protocols/mdns/mdns/0011-Change-a-dynamic-allocation-to-file-scope-variable.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From 9ff06108cd44e84ba6c68bfa6737e793f117e303 Mon Sep 17 00:00:00 2001 | ||
2 | From: Nate Karstens <nate.karstens@garmin.com> | ||
3 | Date: Thu, 10 Aug 2017 08:46:03 -0500 | ||
4 | Subject: [PATCH] Change a dynamic allocation to file-scope variable | ||
5 | |||
6 | Changes a variable from being dynamically-allocated to being | ||
7 | statically-allocated at the file scope. Addresses a Coverity | ||
8 | issue where it appeared that the memory was being leaked. | ||
9 | |||
10 | Upstream-Status: Submitted [dts@apple.com] | ||
11 | |||
12 | Signed-off-by: Nate Karstens <nate.karstens@garmin.com> | ||
13 | --- | ||
14 | mDNSPosix/mDNSPosix.c | 14 ++++---------- | ||
15 | 1 file changed, 4 insertions(+), 10 deletions(-) | ||
16 | |||
17 | diff --git a/mDNSPosix/mDNSPosix.c b/mDNSPosix/mDNSPosix.c | ||
18 | index 7aeee7b..2d25016 100755 | ||
19 | --- a/mDNSPosix/mDNSPosix.c | ||
20 | +++ b/mDNSPosix/mDNSPosix.c | ||
21 | @@ -81,6 +81,7 @@ static sigset_t gEventSignalSet; // Signals which event loop list | ||
22 | static sigset_t gEventSignals; // Signals which were received while inside loop | ||
23 | |||
24 | static PosixNetworkInterface *gRecentInterfaces; | ||
25 | +static IfChangeRec gChgRec; | ||
26 | |||
27 | // *************************************************************************** | ||
28 | // Globals (for debugging) | ||
29 | @@ -1641,18 +1642,11 @@ mDNSlocal void InterfaceChangeCallback(int fd, void *context) | ||
30 | mDNSlocal mStatus WatchForInterfaceChange(mDNS *const m) | ||
31 | { | ||
32 | mStatus err; | ||
33 | - IfChangeRec *pChgRec; | ||
34 | |||
35 | - pChgRec = (IfChangeRec*) mDNSPlatformMemAllocateClear(sizeof *pChgRec); | ||
36 | - if (pChgRec == NULL) | ||
37 | - return mStatus_NoMemoryErr; | ||
38 | - | ||
39 | - pChgRec->mDNS = m; | ||
40 | - err = OpenIfNotifySocket(&pChgRec->NotifySD); | ||
41 | + gChgRec.mDNS = m; | ||
42 | + err = OpenIfNotifySocket(&gChgRec.NotifySD); | ||
43 | if (err == 0) | ||
44 | - err = mDNSPosixAddFDToEventLoop(pChgRec->NotifySD, InterfaceChangeCallback, pChgRec); | ||
45 | - if (err) | ||
46 | - mDNSPlatformMemFree(pChgRec); | ||
47 | + err = mDNSPosixAddFDToEventLoop(gChgRec.NotifySD, InterfaceChangeCallback, &gChgRec); | ||
48 | |||
49 | return err; | ||
50 | } | ||
51 | -- | ||
52 | 2.20.1 | ||
53 | |||