summaryrefslogtreecommitdiff
path: root/user/nfs-utils/freeaddrinfo-properly.patch
blob: 7ddcde004e7021dbebd910f9ff828ad3e6961542 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
diff -Naur nfs-utils-2.3.3-orig/support/export/client.c nfs-utils-2.3.3/support/export/client.c
--- nfs-utils-2.3.3-orig/support/export/client.c	2018-09-06 13:09:08.000000000 -0500
+++ nfs-utils-2.3.3/support/export/client.c	2019-04-21 02:48:45.676838188 -0500
@@ -309,7 +309,8 @@
 		init_addrlist(clp, ai);
 
 out:
-	freeaddrinfo(ai);
+	if (ai != NULL)
+		freeaddrinfo(ai);
 	return clp;
 }
 
diff -Naur nfs-utils-2.3.3-orig/tests/nsm_client/nsm_client.c nfs-utils-2.3.3/tests/nsm_client/nsm_client.c
--- nfs-utils-2.3.3-orig/tests/nsm_client/nsm_client.c	2018-09-06 13:09:08.000000000 -0500
+++ nfs-utils-2.3.3/tests/nsm_client/nsm_client.c	2019-04-21 02:35:53.139552780 -0500
@@ -243,7 +243,8 @@
 		printf("RPC client creation failed\n");
 	}
 out:
-	freeaddrinfo(ai);
+	if (ai != NULL)
+		freeaddrinfo(ai);
 	return client;
 }
 
diff -Naur nfs-utils-2.3.3-orig/utils/exportfs/exportfs.c nfs-utils-2.3.3/utils/exportfs/exportfs.c
--- nfs-utils-2.3.3-orig/utils/exportfs/exportfs.c	2018-09-06 13:09:08.000000000 -0500
+++ nfs-utils-2.3.3/utils/exportfs/exportfs.c	2019-04-21 02:40:07.432327005 -0500
@@ -282,7 +282,8 @@
 	validate_export(exp);
 
 out:
-	freeaddrinfo(ai);
+	if (ai != NULL)
+		freeaddrinfo(ai);
 }
 
 static int exportfs_generic(char *arg, char *options, int verbose)
@@ -395,7 +396,8 @@
 	if (!success)
 		xlog(L_ERROR, "Could not find '%s:%s' to unexport.", hname, path);
 
-	freeaddrinfo(ai);
+	if (ai != NULL)
+		freeaddrinfo(ai);
 }
 
 static int unexportfs_generic(char *arg, int verbose)
@@ -639,8 +641,10 @@
 			}
 
 out:
-	freeaddrinfo(results1);
-	freeaddrinfo(results2);
+	if (results1 != NULL)
+		freeaddrinfo(results1);
+	if (results2 != NULL)
+		freeaddrinfo(results2);
 	return result;
 }
 
diff -Naur nfs-utils-2.3.3-orig/utils/mount/stropts.c nfs-utils-2.3.3/utils/mount/stropts.c
--- nfs-utils-2.3.3-orig/utils/mount/stropts.c	2018-09-06 13:09:08.000000000 -0500
+++ nfs-utils-2.3.3/utils/mount/stropts.c	2019-04-21 02:43:18.451874403 -0500
@@ -1263,7 +1263,8 @@
 	} else
 		nfs_error(_("%s: internal option parsing error"), progname);
 
-	freeaddrinfo(mi.address);
+	if (mi.address != NULL)
+		freeaddrinfo(mi.address);
 	free(mi.hostname);
 	return retval;
 }
diff -Naur nfs-utils-2.3.3-orig/utils/mountd/cache.c nfs-utils-2.3.3/utils/mountd/cache.c
--- nfs-utils-2.3.3-orig/utils/mountd/cache.c	2019-04-21 02:33:43.603417171 -0500
+++ nfs-utils-2.3.3/utils/mountd/cache.c	2019-04-21 02:45:11.289792765 -0500
@@ -834,7 +834,8 @@
 out:
 	if (found_path)
 		free(found_path);
-	freeaddrinfo(ai);
+	if (ai != NULL)
+		freeaddrinfo(ai);
 	free(dom);
 	xlog(D_CALL, "nfsd_fh: found %p path %s", found, found ? found->e_path : NULL);
 }
@@ -1355,7 +1356,7 @@
 	xlog(D_CALL, "nfsd_export: found %p path %s", found, path ? path : NULL);
 	if (dom) free(dom);
 	if (path) free(path);
-	freeaddrinfo(ai);
+	if (ai) freeaddrinfo(ai);
 }
 
 
diff -Naur nfs-utils-2.3.3-orig/utils/mountd/mountd.c nfs-utils-2.3.3/utils/mountd/mountd.c
--- nfs-utils-2.3.3-orig/utils/mountd/mountd.c	2018-09-06 13:09:08.000000000 -0500
+++ nfs-utils-2.3.3/utils/mountd/mountd.c	2019-04-21 02:45:41.796526387 -0500
@@ -581,7 +581,8 @@
 				freeaddrinfo(ai);
 				continue;
 			}
-			freeaddrinfo(ai);
+			if (ai != NULL)
+				freeaddrinfo(ai);
 		}
 		cp = &(c->gr_next);
 	}
diff -Naur nfs-utils-2.3.3-orig/utils/statd/hostname.c nfs-utils-2.3.3/utils/statd/hostname.c
--- nfs-utils-2.3.3-orig/utils/statd/hostname.c	2018-09-06 13:09:08.000000000 -0500
+++ nfs-utils-2.3.3/utils/statd/hostname.c	2019-04-21 02:41:39.712446505 -0500
@@ -308,8 +308,10 @@
 			}
 
 out:
-	freeaddrinfo(results2);
-	freeaddrinfo(results1);
+	if (results2 != NULL)
+		freeaddrinfo(results2);
+	if (results1 != NULL)
+		freeaddrinfo(results1);
 
 	xlog(D_CALL, "%s: hostnames %s and %s %s", __func__,
 			hostname1, hostname2,