glibc: install libmvec.so when available
[buildroot-gz.git] / package / libnftnl / 0001-Rename-xfree-to-libnftnl_xfree-to-avoid-symbol-namin.patch
blobfc96a126a21396923710cbb520fdb2af678b3b8f
1 From 610d015143e88629eab07067a4ae0c1d7548cfaf Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Thu, 2 Jun 2016 23:03:27 -0300
4 Subject: [PATCH] Rename xfree() to libnftnl_xfree() to avoid symbol naming
5 conflict
7 When ELF binaries and shared libraries are used, the internal
8 functions of libnftnl such as xfree() are not visible to the outside
9 world (their visibility is 'hidden'). Therefore, the fact that other
10 programs (especially nftables) may have symbols with the same name
11 does not cause any problem.
13 However, when doing static linking on a non-ELF platform (such as
14 Blackfin, which uses the FLAT binary format), there is no way of
15 encoding this visibility. Therefore, the xfree() symbols of libnftnl
16 becomes visible to the outside world, causing a conflict with the
17 xfree() symbol defined by nftables.
19 To solve this, this patch renames the libnftnl xfree() function to
20 libnftnl_xfree().
22 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
23 [Gustavo: update for version 1.0.5]
25 Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
26 ---
27 include/utils.h | 2 +-
28 src/chain.c | 28 ++++++++++++++--------------
29 src/common.c | 2 +-
30 src/expr.c | 4 ++--
31 src/expr/data_reg.c | 4 ++--
32 src/expr/dynset.c | 2 +-
33 src/expr/immediate.c | 2 +-
34 src/expr/log.c | 6 +++---
35 src/expr/lookup.c | 2 +-
36 src/expr/match.c | 6 +++---
37 src/expr/target.c | 6 +++---
38 src/gen.c | 2 +-
39 src/mxml.c | 2 +-
40 src/rule.c | 30 +++++++++++++++---------------
41 src/ruleset.c | 2 +-
42 src/set.c | 22 +++++++++++-----------
43 src/set_elem.c | 20 ++++++++++----------
44 src/table.c | 14 +++++++-------
45 src/trace.c | 14 +++++++-------
46 src/udata.c | 2 +-
47 src/utils.c | 2 +-
48 21 files changed, 87 insertions(+), 87 deletions(-)
50 diff --git a/include/utils.h b/include/utils.h
51 index 46ff18a..0320c96 100644
52 --- a/include/utils.h
53 +++ b/include/utils.h
54 @@ -19,7 +19,7 @@
56 #define __noreturn __attribute__((__noreturn__))
58 -#define xfree(ptr) free((void *)ptr);
59 +#define nftnl_xfree(ptr) free((void *)ptr);
61 #define div_round_up(n, d) (((n) + (d) - 1) / (d))
63 diff --git a/src/chain.c b/src/chain.c
64 index 990c576..b8f1e1f 100644
65 --- a/src/chain.c
66 +++ b/src/chain.c
67 @@ -96,13 +96,13 @@ EXPORT_SYMBOL_ALIAS(nftnl_chain_alloc, nft_chain_alloc);
68 void nftnl_chain_free(const struct nftnl_chain *c)
70 if (c->table != NULL)
71 - xfree(c->table);
72 + nftnl_xfree(c->table);
73 if (c->type != NULL)
74 - xfree(c->type);
75 + nftnl_xfree(c->type);
76 if (c->dev != NULL)
77 - xfree(c->dev);
78 + nftnl_xfree(c->dev);
80 - xfree(c);
81 + nftnl_xfree(c);
83 EXPORT_SYMBOL_ALIAS(nftnl_chain_free, nft_chain_free);
85 @@ -120,7 +120,7 @@ void nftnl_chain_unset(struct nftnl_chain *c, uint16_t attr)
86 switch (attr) {
87 case NFTNL_CHAIN_TABLE:
88 if (c->table) {
89 - xfree(c->table);
90 + nftnl_xfree(c->table);
91 c->table = NULL;
93 break;
94 @@ -128,7 +128,7 @@ void nftnl_chain_unset(struct nftnl_chain *c, uint16_t attr)
95 break;
96 case NFTNL_CHAIN_TYPE:
97 if (c->type) {
98 - xfree(c->type);
99 + nftnl_xfree(c->type);
100 c->type = NULL;
102 break;
103 @@ -143,7 +143,7 @@ void nftnl_chain_unset(struct nftnl_chain *c, uint16_t attr)
104 break;
105 case NFTNL_CHAIN_DEV:
106 if (c->dev) {
107 - xfree(c->dev);
108 + nftnl_xfree(c->dev);
109 c->dev = NULL;
111 break;
112 @@ -179,7 +179,7 @@ void nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
113 break;
114 case NFTNL_CHAIN_TABLE:
115 if (c->table)
116 - xfree(c->table);
117 + nftnl_xfree(c->table);
119 c->table = strdup(data);
120 break;
121 @@ -209,13 +209,13 @@ void nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
122 break;
123 case NFTNL_CHAIN_TYPE:
124 if (c->type)
125 - xfree(c->type);
126 + nftnl_xfree(c->type);
128 c->type = strdup(data);
129 break;
130 case NFTNL_CHAIN_DEV:
131 if (c->dev)
132 - xfree(c->dev);
133 + nftnl_xfree(c->dev);
135 c->dev = strdup(data);
136 break;
137 @@ -535,7 +535,7 @@ int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *c)
138 c->flags |= (1 << NFTNL_CHAIN_NAME);
140 if (tb[NFTA_CHAIN_TABLE]) {
141 - xfree(c->table);
142 + nftnl_xfree(c->table);
143 c->table = strdup(mnl_attr_get_str(tb[NFTA_CHAIN_TABLE]));
144 c->flags |= (1 << NFTNL_CHAIN_TABLE);
146 @@ -562,7 +562,7 @@ int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *c)
147 c->flags |= (1 << NFTNL_CHAIN_HANDLE);
149 if (tb[NFTA_CHAIN_TYPE]) {
150 - xfree(c->type);
151 + nftnl_xfree(c->type);
152 c->type = strdup(mnl_attr_get_str(tb[NFTA_CHAIN_TYPE]));
153 c->flags |= (1 << NFTNL_CHAIN_TYPE);
155 @@ -976,7 +976,7 @@ void nftnl_chain_list_free(struct nftnl_chain_list *list)
156 list_del(&r->head);
157 nftnl_chain_free(r);
159 - xfree(list);
160 + nftnl_xfree(list);
162 EXPORT_SYMBOL_ALIAS(nftnl_chain_list_free, nft_chain_list_free);
164 @@ -1061,6 +1061,6 @@ EXPORT_SYMBOL_ALIAS(nftnl_chain_list_iter_next, nft_chain_list_iter_next);
166 void nftnl_chain_list_iter_destroy(struct nftnl_chain_list_iter *iter)
168 - xfree(iter);
169 + nftnl_xfree(iter);
171 EXPORT_SYMBOL_ALIAS(nftnl_chain_list_iter_destroy, nft_chain_list_iter_destroy);
172 diff --git a/src/common.c b/src/common.c
173 index bf4176c..98f8012 100644
174 --- a/src/common.c
175 +++ b/src/common.c
176 @@ -58,7 +58,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_parse_err_alloc, nft_parse_err_alloc);
178 void nftnl_parse_err_free(struct nftnl_parse_err *err)
180 - xfree(err);
181 + nftnl_xfree(err);
183 EXPORT_SYMBOL_ALIAS(nftnl_parse_err_free, nft_parse_err_free);
185 diff --git a/src/expr.c b/src/expr.c
186 index ed07dc4..6c08bd0 100644
187 --- a/src/expr.c
188 +++ b/src/expr.c
189 @@ -50,7 +50,7 @@ void nftnl_expr_free(const struct nftnl_expr *expr)
190 if (expr->ops->free)
191 expr->ops->free(expr);
193 - xfree(expr);
194 + nftnl_xfree(expr);
196 EXPORT_SYMBOL_ALIAS(nftnl_expr_free, nft_rule_expr_free);
198 @@ -257,7 +257,7 @@ struct nftnl_expr *nftnl_expr_parse(struct nlattr *attr)
199 return expr;
201 err2:
202 - xfree(expr);
203 + nftnl_xfree(expr);
204 err1:
205 return NULL;
207 diff --git a/src/expr/data_reg.c b/src/expr/data_reg.c
208 index 2a23285..2b1a87e 100644
209 --- a/src/expr/data_reg.c
210 +++ b/src/expr/data_reg.c
211 @@ -123,7 +123,7 @@ static int nftnl_data_reg_verdict_xml_parse(union nftnl_data_reg *reg,
212 NFTNL_XML_OPT, err);
213 if (chain != NULL) {
214 if (reg->chain)
215 - xfree(reg->chain);
216 + nftnl_xfree(reg->chain);
218 reg->chain = strdup(chain);
220 @@ -511,7 +511,7 @@ void nftnl_free_verdict(const union nftnl_data_reg *data)
221 switch(data->verdict) {
222 case NFT_JUMP:
223 case NFT_GOTO:
224 - xfree(data->chain);
225 + nftnl_xfree(data->chain);
226 break;
227 default:
228 break;
229 diff --git a/src/expr/dynset.c b/src/expr/dynset.c
230 index c8d97a5..604600a 100644
231 --- a/src/expr/dynset.c
232 +++ b/src/expr/dynset.c
233 @@ -361,7 +361,7 @@ static void nftnl_expr_dynset_free(const struct nftnl_expr *e)
235 struct nftnl_expr_dynset *dynset = nftnl_expr_data(e);
237 - xfree(dynset->set_name);
238 + nftnl_xfree(dynset->set_name);
241 struct expr_ops expr_ops_dynset = {
242 diff --git a/src/expr/immediate.c b/src/expr/immediate.c
243 index eb2ca0f..237f944 100644
244 --- a/src/expr/immediate.c
245 +++ b/src/expr/immediate.c
246 @@ -44,7 +44,7 @@ nftnl_expr_immediate_set(struct nftnl_expr *e, uint16_t type,
247 break;
248 case NFTNL_EXPR_IMM_CHAIN:
249 if (imm->data.chain)
250 - xfree(imm->data.chain);
251 + nftnl_xfree(imm->data.chain);
253 imm->data.chain = strdup(data);
254 break;
255 diff --git a/src/expr/log.c b/src/expr/log.c
256 index c3dc0a6..ab24686 100644
257 --- a/src/expr/log.c
258 +++ b/src/expr/log.c
259 @@ -38,7 +38,7 @@ static int nftnl_expr_log_set(struct nftnl_expr *e, uint16_t type,
260 switch(type) {
261 case NFTNL_EXPR_LOG_PREFIX:
262 if (log->prefix)
263 - xfree(log->prefix);
264 + nftnl_xfree(log->prefix);
266 log->prefix = strdup(data);
267 break;
268 @@ -152,7 +152,7 @@ nftnl_expr_log_parse(struct nftnl_expr *e, struct nlattr *attr)
270 if (tb[NFTA_LOG_PREFIX]) {
271 if (log->prefix)
272 - xfree(log->prefix);
273 + nftnl_xfree(log->prefix);
275 log->prefix = strdup(mnl_attr_get_str(tb[NFTA_LOG_PREFIX]));
276 e->flags |= (1 << NFTNL_EXPR_LOG_PREFIX);
277 @@ -329,7 +329,7 @@ static void nftnl_expr_log_free(const struct nftnl_expr *e)
279 struct nftnl_expr_log *log = nftnl_expr_data(e);
281 - xfree(log->prefix);
282 + nftnl_xfree(log->prefix);
285 struct expr_ops expr_ops_log = {
286 diff --git a/src/expr/lookup.c b/src/expr/lookup.c
287 index ed32ba6..6e9b0e6 100644
288 --- a/src/expr/lookup.c
289 +++ b/src/expr/lookup.c
290 @@ -258,7 +258,7 @@ static void nftnl_expr_lookup_free(const struct nftnl_expr *e)
292 struct nftnl_expr_lookup *lookup = nftnl_expr_data(e);
294 - xfree(lookup->set_name);
295 + nftnl_xfree(lookup->set_name);
298 struct expr_ops expr_ops_lookup = {
299 diff --git a/src/expr/match.c b/src/expr/match.c
300 index 2929b43..ec46394 100644
301 --- a/src/expr/match.c
302 +++ b/src/expr/match.c
303 @@ -50,7 +50,7 @@ nftnl_expr_match_set(struct nftnl_expr *e, uint16_t type,
304 break;
305 case NFTNL_EXPR_MT_INFO:
306 if (mt->data)
307 - xfree(mt->data);
308 + nftnl_xfree(mt->data);
310 mt->data = data;
311 mt->data_len = data_len;
312 @@ -147,7 +147,7 @@ static int nftnl_expr_match_parse(struct nftnl_expr *e, struct nlattr *attr)
313 void *match_data;
315 if (match->data)
316 - xfree(match->data);
317 + nftnl_xfree(match->data);
319 match_data = calloc(1, len);
320 if (match_data == NULL)
321 @@ -237,7 +237,7 @@ static void nftnl_expr_match_free(const struct nftnl_expr *e)
323 struct nftnl_expr_match *match = nftnl_expr_data(e);
325 - xfree(match->data);
326 + nftnl_xfree(match->data);
329 struct expr_ops expr_ops_match = {
330 diff --git a/src/expr/target.c b/src/expr/target.c
331 index 68a7d8a..05f9e5a 100644
332 --- a/src/expr/target.c
333 +++ b/src/expr/target.c
334 @@ -50,7 +50,7 @@ nftnl_expr_target_set(struct nftnl_expr *e, uint16_t type,
335 break;
336 case NFTNL_EXPR_TG_INFO:
337 if (tg->data)
338 - xfree(tg->data);
339 + nftnl_xfree(tg->data);
341 tg->data = data;
342 tg->data_len = data_len;
343 @@ -147,7 +147,7 @@ static int nftnl_expr_target_parse(struct nftnl_expr *e, struct nlattr *attr)
344 void *target_data;
346 if (target->data)
347 - xfree(target->data);
348 + nftnl_xfree(target->data);
350 target_data = calloc(1, len);
351 if (target_data == NULL)
352 @@ -238,7 +238,7 @@ static void nftnl_expr_target_free(const struct nftnl_expr *e)
354 struct nftnl_expr_target *target = nftnl_expr_data(e);
356 - xfree(target->data);
357 + nftnl_xfree(target->data);
360 struct expr_ops expr_ops_target = {
361 diff --git a/src/gen.c b/src/gen.c
362 index 115a105..576771a 100644
363 --- a/src/gen.c
364 +++ b/src/gen.c
365 @@ -37,7 +37,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_gen_alloc, nft_gen_alloc);
367 void nftnl_gen_free(const struct nftnl_gen *gen)
369 - xfree(gen);
370 + nftnl_xfree(gen);
372 EXPORT_SYMBOL_ALIAS(nftnl_gen_free, nft_gen_free);
374 diff --git a/src/mxml.c b/src/mxml.c
375 index 51dbf1b..5b2aa57 100644
376 --- a/src/mxml.c
377 +++ b/src/mxml.c
378 @@ -85,7 +85,7 @@ struct nftnl_expr *nftnl_mxml_expr_parse(mxml_node_t *node,
379 goto err_expr;
381 tree = mxmlLoadString(NULL, xml_text, MXML_OPAQUE_CALLBACK);
382 - xfree(xml_text);
383 + nftnl_xfree(xml_text);
385 if (tree == NULL)
386 goto err_expr;
387 diff --git a/src/rule.c b/src/rule.c
388 index 8ee8648..8158c26 100644
389 --- a/src/rule.c
390 +++ b/src/rule.c
391 @@ -72,13 +72,13 @@ void nftnl_rule_free(const struct nftnl_rule *r)
392 nftnl_expr_free(e);
394 if (r->table != NULL)
395 - xfree(r->table);
396 + nftnl_xfree(r->table);
397 if (r->chain != NULL)
398 - xfree(r->chain);
399 + nftnl_xfree(r->chain);
400 if (r->user.data != NULL)
401 - xfree(r->user.data);
402 + nftnl_xfree(r->user.data);
404 - xfree(r);
405 + nftnl_xfree(r);
407 EXPORT_SYMBOL_ALIAS(nftnl_rule_free, nft_rule_free);
409 @@ -96,13 +96,13 @@ void nftnl_rule_unset(struct nftnl_rule *r, uint16_t attr)
410 switch (attr) {
411 case NFTNL_RULE_TABLE:
412 if (r->table) {
413 - xfree(r->table);
414 + nftnl_xfree(r->table);
415 r->table = NULL;
417 break;
418 case NFTNL_RULE_CHAIN:
419 if (r->chain) {
420 - xfree(r->chain);
421 + nftnl_xfree(r->chain);
422 r->chain = NULL;
424 break;
425 @@ -138,13 +138,13 @@ void nftnl_rule_set_data(struct nftnl_rule *r, uint16_t attr,
426 switch(attr) {
427 case NFTNL_RULE_TABLE:
428 if (r->table)
429 - xfree(r->table);
430 + nftnl_xfree(r->table);
432 r->table = strdup(data);
433 break;
434 case NFTNL_RULE_CHAIN:
435 if (r->chain)
436 - xfree(r->chain);
437 + nftnl_xfree(r->chain);
439 r->chain = strdup(data);
440 break;
441 @@ -165,7 +165,7 @@ void nftnl_rule_set_data(struct nftnl_rule *r, uint16_t attr,
442 break;
443 case NFTNL_RULE_USERDATA:
444 if (r->user.data != NULL)
445 - xfree(r->user.data);
446 + nftnl_xfree(r->user.data);
448 r->user.data = malloc(data_len);
449 if (!r->user.data)
450 @@ -434,12 +434,12 @@ int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r)
451 return -1;
453 if (tb[NFTA_RULE_TABLE]) {
454 - xfree(r->table);
455 + nftnl_xfree(r->table);
456 r->table = strdup(mnl_attr_get_str(tb[NFTA_RULE_TABLE]));
457 r->flags |= (1 << NFTNL_RULE_TABLE);
459 if (tb[NFTA_RULE_CHAIN]) {
460 - xfree(r->chain);
461 + nftnl_xfree(r->chain);
462 r->chain = strdup(mnl_attr_get_str(tb[NFTA_RULE_CHAIN]));
463 r->flags |= (1 << NFTNL_RULE_CHAIN);
465 @@ -460,7 +460,7 @@ int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r)
466 mnl_attr_get_payload(tb[NFTA_RULE_USERDATA]);
468 if (r->user.data)
469 - xfree(r->user.data);
470 + nftnl_xfree(r->user.data);
472 r->user.len = mnl_attr_get_payload_len(tb[NFTA_RULE_USERDATA]);
474 @@ -1054,7 +1054,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_expr_iter_next, nft_rule_expr_iter_next);
476 void nftnl_expr_iter_destroy(struct nftnl_expr_iter *iter)
478 - xfree(iter);
479 + nftnl_xfree(iter);
481 EXPORT_SYMBOL_ALIAS(nftnl_expr_iter_destroy, nft_rule_expr_iter_destroy);
483 @@ -1084,7 +1084,7 @@ void nftnl_rule_list_free(struct nftnl_rule_list *list)
484 list_del(&r->head);
485 nftnl_rule_free(r);
487 - xfree(list);
488 + nftnl_xfree(list);
490 EXPORT_SYMBOL_ALIAS(nftnl_rule_list_free, nft_rule_list_free);
492 @@ -1175,6 +1175,6 @@ EXPORT_SYMBOL_ALIAS(nftnl_rule_list_iter_next, nft_rule_list_iter_next);
494 void nftnl_rule_list_iter_destroy(const struct nftnl_rule_list_iter *iter)
496 - xfree(iter);
497 + nftnl_xfree(iter);
499 EXPORT_SYMBOL_ALIAS(nftnl_rule_list_iter_destroy, nft_rule_list_iter_destroy);
500 diff --git a/src/ruleset.c b/src/ruleset.c
501 index 414b7c4..6ec38c6 100644
502 --- a/src/ruleset.c
503 +++ b/src/ruleset.c
504 @@ -74,7 +74,7 @@ void nftnl_ruleset_free(const struct nftnl_ruleset *r)
505 nftnl_set_list_free(r->set_list);
506 if (r->flags & (1 << NFTNL_RULESET_RULELIST))
507 nftnl_rule_list_free(r->rule_list);
508 - xfree(r);
509 + nftnl_xfree(r);
511 EXPORT_SYMBOL_ALIAS(nftnl_ruleset_free, nft_ruleset_free);
513 diff --git a/src/set.c b/src/set.c
514 index dbea93b..025d50c 100644
515 --- a/src/set.c
516 +++ b/src/set.c
517 @@ -45,15 +45,15 @@ void nftnl_set_free(const struct nftnl_set *s)
518 struct nftnl_set_elem *elem, *tmp;
520 if (s->table != NULL)
521 - xfree(s->table);
522 + nftnl_xfree(s->table);
523 if (s->name != NULL)
524 - xfree(s->name);
525 + nftnl_xfree(s->name);
527 list_for_each_entry_safe(elem, tmp, &s->element_list, head) {
528 list_del(&elem->head);
529 nftnl_set_elem_free(elem);
531 - xfree(s);
532 + nftnl_xfree(s);
534 EXPORT_SYMBOL_ALIAS(nftnl_set_free, nft_set_free);
536 @@ -69,14 +69,14 @@ void nftnl_set_unset(struct nftnl_set *s, uint16_t attr)
537 case NFTNL_SET_TABLE:
538 if (s->flags & (1 << NFTNL_SET_TABLE))
539 if (s->table) {
540 - xfree(s->table);
541 + nftnl_xfree(s->table);
542 s->table = NULL;
544 break;
545 case NFTNL_SET_NAME:
546 if (s->flags & (1 << NFTNL_SET_NAME))
547 if (s->name) {
548 - xfree(s->name);
549 + nftnl_xfree(s->name);
550 s->name = NULL;
552 break;
553 @@ -124,13 +124,13 @@ void nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data,
554 switch(attr) {
555 case NFTNL_SET_TABLE:
556 if (s->table)
557 - xfree(s->table);
558 + nftnl_xfree(s->table);
560 s->table = strdup(data);
561 break;
562 case NFTNL_SET_NAME:
563 if (s->name)
564 - xfree(s->name);
565 + nftnl_xfree(s->name);
567 s->name = strdup(data);
568 break;
569 @@ -435,12 +435,12 @@ int nftnl_set_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s)
570 return -1;
572 if (tb[NFTA_SET_TABLE]) {
573 - xfree(s->table);
574 + nftnl_xfree(s->table);
575 s->table = strdup(mnl_attr_get_str(tb[NFTA_SET_TABLE]));
576 s->flags |= (1 << NFTNL_SET_TABLE);
578 if (tb[NFTA_SET_NAME]) {
579 - xfree(s->name);
580 + nftnl_xfree(s->name);
581 s->name = strdup(mnl_attr_get_str(tb[NFTA_SET_NAME]));
582 s->flags |= (1 << NFTNL_SET_NAME);
584 @@ -1087,7 +1087,7 @@ void nftnl_set_list_free(struct nftnl_set_list *list)
585 list_del(&s->head);
586 nftnl_set_free(s);
588 - xfree(list);
589 + nftnl_xfree(list);
591 EXPORT_SYMBOL_ALIAS(nftnl_set_list_free, nft_set_list_free);
593 @@ -1177,7 +1177,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_set_list_iter_next, nft_set_list_iter_next);
595 void nftnl_set_list_iter_destroy(const struct nftnl_set_list_iter *iter)
597 - xfree(iter);
598 + nftnl_xfree(iter);
600 EXPORT_SYMBOL_ALIAS(nftnl_set_list_iter_destroy, nft_set_list_iter_destroy);
602 diff --git a/src/set_elem.c b/src/set_elem.c
603 index b9c7e1e..c8ffeae 100644
604 --- a/src/set_elem.c
605 +++ b/src/set_elem.c
606 @@ -43,7 +43,7 @@ void nftnl_set_elem_free(struct nftnl_set_elem *s)
608 if (s->flags & (1 << NFTNL_SET_ELEM_CHAIN)) {
609 if (s->data.chain) {
610 - xfree(s->data.chain);
611 + nftnl_xfree(s->data.chain);
612 s->data.chain = NULL;
615 @@ -52,9 +52,9 @@ void nftnl_set_elem_free(struct nftnl_set_elem *s)
616 nftnl_expr_free(s->expr);
618 if (s->flags & (1 << NFTNL_SET_ELEM_USERDATA))
619 - xfree(s->user.data);
620 + nftnl_xfree(s->user.data);
622 - xfree(s);
623 + nftnl_xfree(s);
625 EXPORT_SYMBOL_ALIAS(nftnl_set_elem_free, nft_set_elem_free);
627 @@ -70,7 +70,7 @@ void nftnl_set_elem_unset(struct nftnl_set_elem *s, uint16_t attr)
628 case NFTNL_SET_ELEM_CHAIN:
629 if (s->flags & (1 << NFTNL_SET_ELEM_CHAIN)) {
630 if (s->data.chain) {
631 - xfree(s->data.chain);
632 + nftnl_xfree(s->data.chain);
633 s->data.chain = NULL;
636 @@ -113,7 +113,7 @@ void nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr,
637 break;
638 case NFTNL_SET_ELEM_CHAIN: /* NFTA_SET_ELEM_DATA */
639 if (s->data.chain)
640 - xfree(s->data.chain);
641 + nftnl_xfree(s->data.chain);
643 s->data.chain = strdup(data);
644 break;
645 @@ -126,7 +126,7 @@ void nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr,
646 break;
647 case NFTNL_SET_ELEM_USERDATA: /* NFTA_SET_ELEM_USERDATA */
648 if (s->user.data != NULL)
649 - xfree(s->user.data);
650 + nftnl_xfree(s->user.data);
652 s->user.data = malloc(data_len);
653 if (!s->user.data)
654 @@ -399,7 +399,7 @@ static int nftnl_set_elems_parse2(struct nftnl_set *s, const struct nlattr *nest
655 mnl_attr_get_payload(tb[NFTA_SET_ELEM_USERDATA]);
657 if (e->user.data)
658 - xfree(e->user.data);
659 + nftnl_xfree(e->user.data);
661 e->user.len = mnl_attr_get_payload_len(tb[NFTA_SET_ELEM_USERDATA]);
662 e->user.data = malloc(e->user.len);
663 @@ -471,13 +471,13 @@ int nftnl_set_elems_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s)
664 return -1;
666 if (tb[NFTA_SET_ELEM_LIST_TABLE]) {
667 - xfree(s->table);
668 + nftnl_xfree(s->table);
669 s->table =
670 strdup(mnl_attr_get_str(tb[NFTA_SET_ELEM_LIST_TABLE]));
671 s->flags |= (1 << NFTNL_SET_TABLE);
673 if (tb[NFTA_SET_ELEM_LIST_SET]) {
674 - xfree(s->name);
675 + nftnl_xfree(s->name);
676 s->name =
677 strdup(mnl_attr_get_str(tb[NFTA_SET_ELEM_LIST_SET]));
678 s->flags |= (1 << NFTNL_SET_NAME);
679 @@ -866,7 +866,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_set_elems_iter_next, nft_set_elems_iter_next);
681 void nftnl_set_elems_iter_destroy(struct nftnl_set_elems_iter *iter)
683 - xfree(iter);
684 + nftnl_xfree(iter);
686 EXPORT_SYMBOL_ALIAS(nftnl_set_elems_iter_destroy, nft_set_elems_iter_destroy);
688 diff --git a/src/table.c b/src/table.c
689 index 42fe49f..7363853 100644
690 --- a/src/table.c
691 +++ b/src/table.c
692 @@ -45,9 +45,9 @@ EXPORT_SYMBOL_ALIAS(nftnl_table_alloc, nft_table_alloc);
693 void nftnl_table_free(const struct nftnl_table *t)
695 if (t->flags & (1 << NFTNL_TABLE_NAME))
696 - xfree(t->name);
697 + nftnl_xfree(t->name);
699 - xfree(t);
700 + nftnl_xfree(t);
702 EXPORT_SYMBOL_ALIAS(nftnl_table_free, nft_table_free);
704 @@ -65,7 +65,7 @@ void nftnl_table_unset(struct nftnl_table *t, uint16_t attr)
705 switch (attr) {
706 case NFTNL_TABLE_NAME:
707 if (t->name) {
708 - xfree(t->name);
709 + nftnl_xfree(t->name);
710 t->name = NULL;
712 break;
713 @@ -95,7 +95,7 @@ void nftnl_table_set_data(struct nftnl_table *t, uint16_t attr,
714 switch (attr) {
715 case NFTNL_TABLE_NAME:
716 if (t->name)
717 - xfree(t->name);
718 + nftnl_xfree(t->name);
720 t->name = strdup(data);
721 break;
722 @@ -229,7 +229,7 @@ int nftnl_table_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_table *t)
723 return -1;
725 if (tb[NFTA_TABLE_NAME]) {
726 - xfree(t->name);
727 + nftnl_xfree(t->name);
728 t->name = strdup(mnl_attr_get_str(tb[NFTA_TABLE_NAME]));
729 t->flags |= (1 << NFTNL_TABLE_NAME);
731 @@ -497,7 +497,7 @@ void nftnl_table_list_free(struct nftnl_table_list *list)
732 list_del(&r->head);
733 nftnl_table_free(r);
735 - xfree(list);
736 + nftnl_xfree(list);
738 EXPORT_SYMBOL_ALIAS(nftnl_table_list_free, nft_table_list_free);
740 @@ -582,6 +582,6 @@ EXPORT_SYMBOL_ALIAS(nftnl_table_list_iter_next, nft_table_list_iter_next);
742 void nftnl_table_list_iter_destroy(const struct nftnl_table_list_iter *iter)
744 - xfree(iter);
745 + nftnl_xfree(iter);
747 EXPORT_SYMBOL_ALIAS(nftnl_table_list_iter_destroy, nft_table_list_iter_destroy);
748 diff --git a/src/trace.c b/src/trace.c
749 index 921fa21..1933bb8 100644
750 --- a/src/trace.c
751 +++ b/src/trace.c
752 @@ -61,13 +61,13 @@ struct nftnl_trace *nftnl_trace_alloc(void)
753 EXPORT_SYMBOL(nftnl_trace_free);
754 void nftnl_trace_free(const struct nftnl_trace *t)
756 - xfree(t->chain);
757 - xfree(t->table);
758 - xfree(t->jump_target);
759 - xfree(t->ll.data);
760 - xfree(t->nh.data);
761 - xfree(t->th.data);
762 - xfree(t);
763 + nftnl_xfree(t->chain);
764 + nftnl_xfree(t->table);
765 + nftnl_xfree(t->jump_target);
766 + nftnl_xfree(t->ll.data);
767 + nftnl_xfree(t->nh.data);
768 + nftnl_xfree(t->th.data);
769 + nftnl_xfree(t);
772 EXPORT_SYMBOL(nftnl_trace_is_set);
773 diff --git a/src/udata.c b/src/udata.c
774 index 60c2f34..ec1f7dc 100644
775 --- a/src/udata.c
776 +++ b/src/udata.c
777 @@ -32,7 +32,7 @@ EXPORT_SYMBOL(nftnl_udata_buf_alloc);
779 void nftnl_udata_buf_free(const struct nftnl_udata_buf *buf)
781 - xfree(buf);
782 + nftnl_xfree(buf);
784 EXPORT_SYMBOL(nftnl_udata_buf_free);
786 diff --git a/src/utils.c b/src/utils.c
787 index 22710b9..f29416e 100644
788 --- a/src/utils.c
789 +++ b/src/utils.c
790 @@ -264,7 +264,7 @@ int nftnl_fprintf(FILE *fp, const void *obj, uint32_t cmd, uint32_t type,
792 out:
793 if (buf != _buf)
794 - xfree(buf);
795 + nftnl_xfree(buf);
797 return ret;
800 2.7.3