pkg-perl: set PERL_USE_UNSAFE_INC
[buildroot-gz.git] / package / libnftnl / 0001-Rename-xfree-to-libnftnl_xfree-to-avoid-symbol-namin.patch
blob6f5be4e7ef0240b4b93311798646220d550207fc
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.7]
24 Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
25 ---
26 include/utils.h | 2 +-
27 src/chain.c | 36 ++++++++++++++++++------------------
28 src/common.c | 2 +-
29 src/expr.c | 4 ++--
30 src/expr/data_reg.c | 2 +-
31 src/expr/dynset.c | 2 +-
32 src/expr/immediate.c | 2 +-
33 src/expr/log.c | 6 +++---
34 src/expr/lookup.c | 2 +-
35 src/expr/match.c | 6 +++---
36 src/expr/target.c | 6 +++---
37 src/gen.c | 2 +-
38 src/object.c | 14 +++++++-------
39 src/rule.c | 32 ++++++++++++++++----------------
40 src/ruleset.c | 2 +-
41 src/set.c | 26 +++++++++++++-------------
42 src/set_elem.c | 28 ++++++++++++++--------------
43 src/table.c | 14 +++++++-------
44 src/trace.c | 14 +++++++-------
45 src/udata.c | 2 +-
46 src/utils.c | 2 +-
47 21 files changed, 103 insertions(+), 103 deletions(-)
49 diff --git a/include/utils.h b/include/utils.h
50 index 924df32..f02fce7 100644
51 --- a/include/utils.h
52 +++ b/include/utils.h
53 @@ -19,7 +19,7 @@
55 #define __noreturn __attribute__((__noreturn__))
57 -#define xfree(ptr) free((void *)ptr);
58 +#define nftnl_xfree(ptr) free((void *)ptr);
60 #define div_round_up(n, d) (((n) + (d) - 1) / (d))
62 diff --git a/src/chain.c b/src/chain.c
63 index 49cd094..444cb79 100644
64 --- a/src/chain.c
65 +++ b/src/chain.c
66 @@ -96,14 +96,14 @@ EXPORT_SYMBOL_ALIAS(nftnl_chain_alloc, nft_chain_alloc);
67 void nftnl_chain_free(const struct nftnl_chain *c)
69 if (c->flags & (1 << NFTNL_CHAIN_NAME))
70 - xfree(c->name);
71 + nftnl_xfree(c->name);
72 if (c->flags & (1 << NFTNL_CHAIN_TABLE))
73 - xfree(c->table);
74 + nftnl_xfree(c->table);
75 if (c->flags & (1 << NFTNL_CHAIN_TYPE))
76 - xfree(c->type);
77 + nftnl_xfree(c->type);
78 if (c->flags & (1 << NFTNL_CHAIN_DEV))
79 - xfree(c->dev);
80 - xfree(c);
81 + nftnl_xfree(c->dev);
82 + nftnl_xfree(c);
84 EXPORT_SYMBOL_ALIAS(nftnl_chain_free, nft_chain_free);
86 @@ -120,15 +120,15 @@ void nftnl_chain_unset(struct nftnl_chain *c, uint16_t attr)
88 switch (attr) {
89 case NFTNL_CHAIN_NAME:
90 - xfree(c->name);
91 + nftnl_xfree(c->name);
92 break;
93 case NFTNL_CHAIN_TABLE:
94 - xfree(c->table);
95 + nftnl_xfree(c->table);
96 break;
97 case NFTNL_CHAIN_USE:
98 break;
99 case NFTNL_CHAIN_TYPE:
100 - xfree(c->type);
101 + nftnl_xfree(c->type);
102 break;
103 case NFTNL_CHAIN_HOOKNUM:
104 case NFTNL_CHAIN_PRIO:
105 @@ -139,7 +139,7 @@ void nftnl_chain_unset(struct nftnl_chain *c, uint16_t attr)
106 case NFTNL_CHAIN_FAMILY:
107 break;
108 case NFTNL_CHAIN_DEV:
109 - xfree(c->dev);
110 + nftnl_xfree(c->dev);
111 break;
112 default:
113 return;
114 @@ -168,7 +168,7 @@ int nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
115 switch(attr) {
116 case NFTNL_CHAIN_NAME:
117 if (c->flags & (1 << NFTNL_CHAIN_NAME))
118 - xfree(c->name);
119 + nftnl_xfree(c->name);
121 c->name = strdup(data);
122 if (!c->name)
123 @@ -176,7 +176,7 @@ int nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
124 break;
125 case NFTNL_CHAIN_TABLE:
126 if (c->flags & (1 << NFTNL_CHAIN_TABLE))
127 - xfree(c->table);
128 + nftnl_xfree(c->table);
130 c->table = strdup(data);
131 if (!c->table)
132 @@ -208,7 +208,7 @@ int nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
133 break;
134 case NFTNL_CHAIN_TYPE:
135 if (c->flags & (1 << NFTNL_CHAIN_TYPE))
136 - xfree(c->type);
137 + nftnl_xfree(c->type);
139 c->type = strdup(data);
140 if (!c->type)
141 @@ -216,7 +216,7 @@ int nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
142 break;
143 case NFTNL_CHAIN_DEV:
144 if (c->flags & (1 << NFTNL_CHAIN_DEV))
145 - xfree(c->dev);
146 + nftnl_xfree(c->dev);
148 c->dev = strdup(data);
149 if (!c->dev)
150 @@ -540,7 +540,7 @@ int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *c)
152 if (tb[NFTA_CHAIN_NAME]) {
153 if (c->flags & (1 << NFTNL_CHAIN_NAME))
154 - xfree(c->name);
155 + nftnl_xfree(c->name);
156 c->name = strdup(mnl_attr_get_str(tb[NFTA_CHAIN_NAME]));
157 if (!c->name)
158 return -1;
159 @@ -548,7 +548,7 @@ int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *c)
161 if (tb[NFTA_CHAIN_TABLE]) {
162 if (c->flags & (1 << NFTNL_CHAIN_TABLE))
163 - xfree(c->table);
164 + nftnl_xfree(c->table);
165 c->table = strdup(mnl_attr_get_str(tb[NFTA_CHAIN_TABLE]));
166 if (!c->table)
167 return -1;
168 @@ -578,7 +578,7 @@ int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *c)
170 if (tb[NFTA_CHAIN_TYPE]) {
171 if (c->flags & (1 << NFTNL_CHAIN_TYPE))
172 - xfree(c->type);
173 + nftnl_xfree(c->type);
174 c->type = strdup(mnl_attr_get_str(tb[NFTA_CHAIN_TYPE]));
175 if (!c->type)
176 return -1;
177 @@ -889,7 +889,7 @@ void nftnl_chain_list_free(struct nftnl_chain_list *list)
178 list_del(&r->head);
179 nftnl_chain_free(r);
181 - xfree(list);
182 + nftnl_xfree(list);
184 EXPORT_SYMBOL_ALIAS(nftnl_chain_list_free, nft_chain_list_free);
186 @@ -975,6 +975,6 @@ EXPORT_SYMBOL_ALIAS(nftnl_chain_list_iter_next, nft_chain_list_iter_next);
188 void nftnl_chain_list_iter_destroy(struct nftnl_chain_list_iter *iter)
190 - xfree(iter);
191 + nftnl_xfree(iter);
193 EXPORT_SYMBOL_ALIAS(nftnl_chain_list_iter_destroy, nft_chain_list_iter_destroy);
194 diff --git a/src/common.c b/src/common.c
195 index bf4176c..98f8012 100644
196 --- a/src/common.c
197 +++ b/src/common.c
198 @@ -58,7 +58,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_parse_err_alloc, nft_parse_err_alloc);
200 void nftnl_parse_err_free(struct nftnl_parse_err *err)
202 - xfree(err);
203 + nftnl_xfree(err);
205 EXPORT_SYMBOL_ALIAS(nftnl_parse_err_free, nft_parse_err_free);
207 diff --git a/src/expr.c b/src/expr.c
208 index 8d5c562..47ecd3d 100644
209 --- a/src/expr.c
210 +++ b/src/expr.c
211 @@ -50,7 +50,7 @@ void nftnl_expr_free(const struct nftnl_expr *expr)
212 if (expr->ops->free)
213 expr->ops->free(expr);
215 - xfree(expr);
216 + nftnl_xfree(expr);
218 EXPORT_SYMBOL_ALIAS(nftnl_expr_free, nft_rule_expr_free);
220 @@ -270,7 +270,7 @@ struct nftnl_expr *nftnl_expr_parse(struct nlattr *attr)
221 return expr;
223 err2:
224 - xfree(expr);
225 + nftnl_xfree(expr);
226 err1:
227 return NULL;
229 diff --git a/src/expr/data_reg.c b/src/expr/data_reg.c
230 index 0249258..994b388 100644
231 --- a/src/expr/data_reg.c
232 +++ b/src/expr/data_reg.c
233 @@ -376,7 +376,7 @@ void nftnl_free_verdict(const union nftnl_data_reg *data)
234 switch(data->verdict) {
235 case NFT_JUMP:
236 case NFT_GOTO:
237 - xfree(data->chain);
238 + nftnl_xfree(data->chain);
239 break;
240 default:
241 break;
242 diff --git a/src/expr/dynset.c b/src/expr/dynset.c
243 index 20a5004..f3d46a7 100644
244 --- a/src/expr/dynset.c
245 +++ b/src/expr/dynset.c
246 @@ -330,7 +330,7 @@ static void nftnl_expr_dynset_free(const struct nftnl_expr *e)
248 struct nftnl_expr_dynset *dynset = nftnl_expr_data(e);
250 - xfree(dynset->set_name);
251 + nftnl_xfree(dynset->set_name);
254 static bool nftnl_expr_dynset_cmp(const struct nftnl_expr *e1,
255 diff --git a/src/expr/immediate.c b/src/expr/immediate.c
256 index 0b188cc..6c17f68 100644
257 --- a/src/expr/immediate.c
258 +++ b/src/expr/immediate.c
259 @@ -44,7 +44,7 @@ nftnl_expr_immediate_set(struct nftnl_expr *e, uint16_t type,
260 break;
261 case NFTNL_EXPR_IMM_CHAIN:
262 if (e->flags & (1 << NFTNL_EXPR_IMM_CHAIN))
263 - xfree(imm->data.chain);
264 + nftnl_xfree(imm->data.chain);
266 imm->data.chain = strdup(data);
267 if (!imm->data.chain)
268 diff --git a/src/expr/log.c b/src/expr/log.c
269 index b642255..2b24b6d 100644
270 --- a/src/expr/log.c
271 +++ b/src/expr/log.c
272 @@ -39,7 +39,7 @@ static int nftnl_expr_log_set(struct nftnl_expr *e, uint16_t type,
273 switch(type) {
274 case NFTNL_EXPR_LOG_PREFIX:
275 if (log->flags & (1 << NFTNL_EXPR_LOG_PREFIX))
276 - xfree(log->prefix);
277 + nftnl_xfree(log->prefix);
279 log->prefix = strdup(data);
280 if (!log->prefix)
281 @@ -155,7 +155,7 @@ nftnl_expr_log_parse(struct nftnl_expr *e, struct nlattr *attr)
283 if (tb[NFTA_LOG_PREFIX]) {
284 if (log->prefix)
285 - xfree(log->prefix);
286 + nftnl_xfree(log->prefix);
288 log->prefix = strdup(mnl_attr_get_str(tb[NFTA_LOG_PREFIX]));
289 if (!log->prefix)
290 @@ -316,7 +316,7 @@ static void nftnl_expr_log_free(const struct nftnl_expr *e)
292 struct nftnl_expr_log *log = nftnl_expr_data(e);
294 - xfree(log->prefix);
295 + nftnl_xfree(log->prefix);
298 static bool nftnl_expr_log_cmp(const struct nftnl_expr *e1,
299 diff --git a/src/expr/lookup.c b/src/expr/lookup.c
300 index 861815f..1955ed3 100644
301 --- a/src/expr/lookup.c
302 +++ b/src/expr/lookup.c
303 @@ -259,7 +259,7 @@ static void nftnl_expr_lookup_free(const struct nftnl_expr *e)
305 struct nftnl_expr_lookup *lookup = nftnl_expr_data(e);
307 - xfree(lookup->set_name);
308 + nftnl_xfree(lookup->set_name);
311 static bool nftnl_expr_lookup_cmp(const struct nftnl_expr *e1,
312 diff --git a/src/expr/match.c b/src/expr/match.c
313 index dd09e1e..09e35c5 100644
314 --- a/src/expr/match.c
315 +++ b/src/expr/match.c
316 @@ -50,7 +50,7 @@ nftnl_expr_match_set(struct nftnl_expr *e, uint16_t type,
317 break;
318 case NFTNL_EXPR_MT_INFO:
319 if (e->flags & (1 << NFTNL_EXPR_MT_INFO))
320 - xfree(mt->data);
321 + nftnl_xfree(mt->data);
323 mt->data = data;
324 mt->data_len = data_len;
325 @@ -147,7 +147,7 @@ static int nftnl_expr_match_parse(struct nftnl_expr *e, struct nlattr *attr)
326 void *match_data;
328 if (e->flags & (1 << NFTNL_EXPR_MT_INFO))
329 - xfree(match->data);
330 + nftnl_xfree(match->data);
332 match_data = calloc(1, len);
333 if (match_data == NULL)
334 @@ -217,7 +217,7 @@ static void nftnl_expr_match_free(const struct nftnl_expr *e)
336 struct nftnl_expr_match *match = nftnl_expr_data(e);
338 - xfree(match->data);
339 + nftnl_xfree(match->data);
342 static bool nftnl_expr_match_cmp(const struct nftnl_expr *e1,
343 diff --git a/src/expr/target.c b/src/expr/target.c
344 index ed4bf7d..5e28925 100644
345 --- a/src/expr/target.c
346 +++ b/src/expr/target.c
347 @@ -50,7 +50,7 @@ nftnl_expr_target_set(struct nftnl_expr *e, uint16_t type,
348 break;
349 case NFTNL_EXPR_TG_INFO:
350 if (e->flags & (1 << NFTNL_EXPR_TG_INFO))
351 - xfree(tg->data);
352 + nftnl_xfree(tg->data);
354 tg->data = data;
355 tg->data_len = data_len;
356 @@ -147,7 +147,7 @@ static int nftnl_expr_target_parse(struct nftnl_expr *e, struct nlattr *attr)
357 void *target_data;
359 if (target->data)
360 - xfree(target->data);
361 + nftnl_xfree(target->data);
363 target_data = calloc(1, len);
364 if (target_data == NULL)
365 @@ -217,7 +217,7 @@ static void nftnl_expr_target_free(const struct nftnl_expr *e)
367 struct nftnl_expr_target *target = nftnl_expr_data(e);
369 - xfree(target->data);
370 + nftnl_xfree(target->data);
373 static bool nftnl_expr_target_cmp(const struct nftnl_expr *e1,
374 diff --git a/src/gen.c b/src/gen.c
375 index c69d2f8..0143ea0 100644
376 --- a/src/gen.c
377 +++ b/src/gen.c
378 @@ -37,7 +37,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_gen_alloc, nft_gen_alloc);
380 void nftnl_gen_free(const struct nftnl_gen *gen)
382 - xfree(gen);
383 + nftnl_xfree(gen);
385 EXPORT_SYMBOL_ALIAS(nftnl_gen_free, nft_gen_free);
387 diff --git a/src/object.c b/src/object.c
388 index 0d3dc2b..542211c 100644
389 --- a/src/object.c
390 +++ b/src/object.c
391 @@ -47,11 +47,11 @@ EXPORT_SYMBOL(nftnl_obj_alloc);
392 void nftnl_obj_free(const struct nftnl_obj *obj)
394 if (obj->flags & (1 << NFTNL_OBJ_TABLE))
395 - xfree(obj->table);
396 + nftnl_xfree(obj->table);
397 if (obj->flags & (1 << NFTNL_OBJ_NAME))
398 - xfree(obj->name);
399 + nftnl_xfree(obj->name);
401 - xfree(obj);
402 + nftnl_xfree(obj);
404 EXPORT_SYMBOL(nftnl_obj_free);
406 @@ -74,11 +74,11 @@ void nftnl_obj_set_data(struct nftnl_obj *obj, uint16_t attr,
408 switch (attr) {
409 case NFTNL_OBJ_TABLE:
410 - xfree(obj->table);
411 + nftnl_xfree(obj->table);
412 obj->table = strdup(data);
413 break;
414 case NFTNL_OBJ_NAME:
415 - xfree(obj->name);
416 + nftnl_xfree(obj->name);
417 obj->name = strdup(data);
418 break;
419 case NFTNL_OBJ_TYPE:
420 @@ -486,7 +486,7 @@ void nftnl_obj_list_free(struct nftnl_obj_list *list)
421 list_del(&r->head);
422 nftnl_obj_free(r);
424 - xfree(list);
425 + nftnl_xfree(list);
427 EXPORT_SYMBOL(nftnl_obj_list_free);
429 @@ -573,6 +573,6 @@ EXPORT_SYMBOL(nftnl_obj_list_iter_next);
431 void nftnl_obj_list_iter_destroy(struct nftnl_obj_list_iter *iter)
433 - xfree(iter);
434 + nftnl_xfree(iter);
436 EXPORT_SYMBOL(nftnl_obj_list_iter_destroy);
437 diff --git a/src/rule.c b/src/rule.c
438 index 22026a4..256b699 100644
439 --- a/src/rule.c
440 +++ b/src/rule.c
441 @@ -72,13 +72,13 @@ void nftnl_rule_free(const struct nftnl_rule *r)
442 nftnl_expr_free(e);
444 if (r->flags & (1 << (NFTNL_RULE_TABLE)))
445 - xfree(r->table);
446 + nftnl_xfree(r->table);
447 if (r->flags & (1 << (NFTNL_RULE_CHAIN)))
448 - xfree(r->chain);
449 + nftnl_xfree(r->chain);
450 if (r->flags & (1 << (NFTNL_RULE_USERDATA)))
451 - xfree(r->user.data);
452 + nftnl_xfree(r->user.data);
454 - xfree(r);
455 + nftnl_xfree(r);
457 EXPORT_SYMBOL_ALIAS(nftnl_rule_free, nft_rule_free);
459 @@ -95,10 +95,10 @@ void nftnl_rule_unset(struct nftnl_rule *r, uint16_t attr)
461 switch (attr) {
462 case NFTNL_RULE_TABLE:
463 - xfree(r->table);
464 + nftnl_xfree(r->table);
465 break;
466 case NFTNL_RULE_CHAIN:
467 - xfree(r->chain);
468 + nftnl_xfree(r->chain);
469 break;
470 case NFTNL_RULE_HANDLE:
471 case NFTNL_RULE_COMPAT_PROTO:
472 @@ -107,7 +107,7 @@ void nftnl_rule_unset(struct nftnl_rule *r, uint16_t attr)
473 case NFTNL_RULE_FAMILY:
474 break;
475 case NFTNL_RULE_USERDATA:
476 - xfree(r->user.data);
477 + nftnl_xfree(r->user.data);
478 break;
481 @@ -132,7 +132,7 @@ int nftnl_rule_set_data(struct nftnl_rule *r, uint16_t attr,
482 switch(attr) {
483 case NFTNL_RULE_TABLE:
484 if (r->flags & (1 << NFTNL_RULE_TABLE))
485 - xfree(r->table);
486 + nftnl_xfree(r->table);
488 r->table = strdup(data);
489 if (!r->table)
490 @@ -140,7 +140,7 @@ int nftnl_rule_set_data(struct nftnl_rule *r, uint16_t attr,
491 break;
492 case NFTNL_RULE_CHAIN:
493 if (r->flags & (1 << NFTNL_RULE_CHAIN))
494 - xfree(r->chain);
495 + nftnl_xfree(r->chain);
497 r->chain = strdup(data);
498 if (!r->chain)
499 @@ -163,7 +163,7 @@ int nftnl_rule_set_data(struct nftnl_rule *r, uint16_t attr,
500 break;
501 case NFTNL_RULE_USERDATA:
502 if (r->flags & (1 << NFTNL_RULE_USERDATA))
503 - xfree(r->user.data);
504 + nftnl_xfree(r->user.data);
506 r->user.data = malloc(data_len);
507 if (!r->user.data)
508 @@ -436,7 +436,7 @@ int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r)
510 if (tb[NFTA_RULE_TABLE]) {
511 if (r->flags & (1 << NFTNL_RULE_TABLE))
512 - xfree(r->table);
513 + nftnl_xfree(r->table);
514 r->table = strdup(mnl_attr_get_str(tb[NFTA_RULE_TABLE]));
515 if (!r->table)
516 return -1;
517 @@ -444,7 +444,7 @@ int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r)
519 if (tb[NFTA_RULE_CHAIN]) {
520 if (r->flags & (1 << NFTNL_RULE_CHAIN))
521 - xfree(r->chain);
522 + nftnl_xfree(r->chain);
523 r->chain = strdup(mnl_attr_get_str(tb[NFTA_RULE_CHAIN]));
524 if (!r->chain)
525 return -1;
526 @@ -473,7 +473,7 @@ int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r)
527 mnl_attr_get_payload(tb[NFTA_RULE_USERDATA]);
529 if (r->flags & (1 << NFTNL_RULE_USERDATA))
530 - xfree(r->user.data);
531 + nftnl_xfree(r->user.data);
533 r->user.len = mnl_attr_get_payload_len(tb[NFTA_RULE_USERDATA]);
535 @@ -915,7 +915,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_expr_iter_next, nft_rule_expr_iter_next);
537 void nftnl_expr_iter_destroy(struct nftnl_expr_iter *iter)
539 - xfree(iter);
540 + nftnl_xfree(iter);
542 EXPORT_SYMBOL_ALIAS(nftnl_expr_iter_destroy, nft_rule_expr_iter_destroy);
544 @@ -976,7 +976,7 @@ void nftnl_rule_list_free(struct nftnl_rule_list *list)
545 list_del(&r->head);
546 nftnl_rule_free(r);
548 - xfree(list);
549 + nftnl_xfree(list);
551 EXPORT_SYMBOL_ALIAS(nftnl_rule_list_free, nft_rule_list_free);
553 @@ -1068,6 +1068,6 @@ EXPORT_SYMBOL_ALIAS(nftnl_rule_list_iter_next, nft_rule_list_iter_next);
555 void nftnl_rule_list_iter_destroy(const struct nftnl_rule_list_iter *iter)
557 - xfree(iter);
558 + nftnl_xfree(iter);
560 EXPORT_SYMBOL_ALIAS(nftnl_rule_list_iter_destroy, nft_rule_list_iter_destroy);
561 diff --git a/src/ruleset.c b/src/ruleset.c
562 index b6ca565..0867e2a 100644
563 --- a/src/ruleset.c
564 +++ b/src/ruleset.c
565 @@ -71,7 +71,7 @@ void nftnl_ruleset_free(const struct nftnl_ruleset *r)
566 nftnl_set_list_free(r->set_list);
567 if (r->flags & (1 << NFTNL_RULESET_RULELIST))
568 nftnl_rule_list_free(r->rule_list);
569 - xfree(r);
570 + nftnl_xfree(r);
572 EXPORT_SYMBOL_ALIAS(nftnl_ruleset_free, nft_ruleset_free);
574 diff --git a/src/set.c b/src/set.c
575 index 14d28b5..0e93503 100644
576 --- a/src/set.c
577 +++ b/src/set.c
578 @@ -45,15 +45,15 @@ void nftnl_set_free(const struct nftnl_set *s)
579 struct nftnl_set_elem *elem, *tmp;
581 if (s->flags & (1 << NFTNL_SET_TABLE))
582 - xfree(s->table);
583 + nftnl_xfree(s->table);
584 if (s->flags & (1 << NFTNL_SET_NAME))
585 - xfree(s->name);
586 + nftnl_xfree(s->name);
588 list_for_each_entry_safe(elem, tmp, &s->element_list, head) {
589 list_del(&elem->head);
590 nftnl_set_elem_free(elem);
592 - xfree(s);
593 + nftnl_xfree(s);
595 EXPORT_SYMBOL_ALIAS(nftnl_set_free, nft_set_free);
597 @@ -70,10 +70,10 @@ void nftnl_set_unset(struct nftnl_set *s, uint16_t attr)
599 switch (attr) {
600 case NFTNL_SET_TABLE:
601 - xfree(s->table);
602 + nftnl_xfree(s->table);
603 break;
604 case NFTNL_SET_NAME:
605 - xfree(s->name);
606 + nftnl_xfree(s->name);
607 break;
608 case NFTNL_SET_FLAGS:
609 case NFTNL_SET_KEY_TYPE:
610 @@ -89,7 +89,7 @@ void nftnl_set_unset(struct nftnl_set *s, uint16_t attr)
611 case NFTNL_SET_GC_INTERVAL:
612 break;
613 case NFTNL_SET_USERDATA:
614 - xfree(s->user.data);
615 + nftnl_xfree(s->user.data);
616 break;
617 default:
618 return;
619 @@ -122,7 +122,7 @@ int nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data,
620 switch(attr) {
621 case NFTNL_SET_TABLE:
622 if (s->flags & (1 << NFTNL_SET_TABLE))
623 - xfree(s->table);
624 + nftnl_xfree(s->table);
626 s->table = strdup(data);
627 if (!s->table)
628 @@ -130,7 +130,7 @@ int nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data,
629 break;
630 case NFTNL_SET_NAME:
631 if (s->flags & (1 << NFTNL_SET_NAME))
632 - xfree(s->name);
633 + nftnl_xfree(s->name);
635 s->name = strdup(data);
636 if (!s->name)
637 @@ -174,7 +174,7 @@ int nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data,
638 break;
639 case NFTNL_SET_USERDATA:
640 if (s->flags & (1 << NFTNL_SET_USERDATA))
641 - xfree(s->user.data);
642 + nftnl_xfree(s->user.data);
644 s->user.data = malloc(data_len);
645 if (!s->user.data)
646 @@ -474,7 +474,7 @@ int nftnl_set_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s)
648 if (tb[NFTA_SET_TABLE]) {
649 if (s->flags & (1 << NFTNL_SET_TABLE))
650 - xfree(s->table);
651 + nftnl_xfree(s->table);
652 s->table = strdup(mnl_attr_get_str(tb[NFTA_SET_TABLE]));
653 if (!s->table)
654 return -1;
655 @@ -482,7 +482,7 @@ int nftnl_set_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s)
657 if (tb[NFTA_SET_NAME]) {
658 if (s->flags & (1 << NFTNL_SET_NAME))
659 - xfree(s->name);
660 + nftnl_xfree(s->name);
661 s->name = strdup(mnl_attr_get_str(tb[NFTA_SET_NAME]));
662 if (!s->name)
663 return -1;
664 @@ -972,7 +972,7 @@ void nftnl_set_list_free(struct nftnl_set_list *list)
665 list_del(&s->head);
666 nftnl_set_free(s);
668 - xfree(list);
669 + nftnl_xfree(list);
671 EXPORT_SYMBOL_ALIAS(nftnl_set_list_free, nft_set_list_free);
673 @@ -1064,7 +1064,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_set_list_iter_next, nft_set_list_iter_next);
675 void nftnl_set_list_iter_destroy(const struct nftnl_set_list_iter *iter)
677 - xfree(iter);
678 + nftnl_xfree(iter);
680 EXPORT_SYMBOL_ALIAS(nftnl_set_list_iter_destroy, nft_set_list_iter_destroy);
682 diff --git a/src/set_elem.c b/src/set_elem.c
683 index fa87476..6d404bd 100644
684 --- a/src/set_elem.c
685 +++ b/src/set_elem.c
686 @@ -42,18 +42,18 @@ EXPORT_SYMBOL_ALIAS(nftnl_set_elem_alloc, nft_set_elem_alloc);
687 void nftnl_set_elem_free(struct nftnl_set_elem *s)
689 if (s->flags & (1 << NFTNL_SET_ELEM_CHAIN))
690 - xfree(s->data.chain);
691 + nftnl_xfree(s->data.chain);
693 if (s->flags & (1 << NFTNL_SET_ELEM_EXPR))
694 nftnl_expr_free(s->expr);
696 if (s->flags & (1 << NFTNL_SET_ELEM_USERDATA))
697 - xfree(s->user.data);
698 + nftnl_xfree(s->user.data);
700 if (s->flags & (1 << NFTNL_SET_ELEM_OBJREF))
701 - xfree(s->objref);
702 + nftnl_xfree(s->objref);
704 - xfree(s);
705 + nftnl_xfree(s);
707 EXPORT_SYMBOL_ALIAS(nftnl_set_elem_free, nft_set_elem_free);
709 @@ -70,7 +70,7 @@ void nftnl_set_elem_unset(struct nftnl_set_elem *s, uint16_t attr)
711 switch (attr) {
712 case NFTNL_SET_ELEM_CHAIN:
713 - xfree(s->data.chain);
714 + nftnl_xfree(s->data.chain);
715 break;
716 case NFTNL_SET_ELEM_FLAGS:
717 case NFTNL_SET_ELEM_KEY: /* NFTA_SET_ELEM_KEY */
718 @@ -80,13 +80,13 @@ void nftnl_set_elem_unset(struct nftnl_set_elem *s, uint16_t attr)
719 case NFTNL_SET_ELEM_EXPIRATION: /* NFTA_SET_ELEM_EXPIRATION */
720 break;
721 case NFTNL_SET_ELEM_USERDATA: /* NFTA_SET_ELEM_USERDATA */
722 - xfree(s->user.data);
723 + nftnl_xfree(s->user.data);
724 break;
725 case NFTNL_SET_ELEM_EXPR:
726 nftnl_expr_free(s->expr);
727 break;
728 case NFTNL_SET_ELEM_OBJREF:
729 - xfree(s->objref);
730 + nftnl_xfree(s->objref);
731 break;
732 default:
733 return;
734 @@ -112,7 +112,7 @@ int nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr,
735 break;
736 case NFTNL_SET_ELEM_CHAIN: /* NFTA_SET_ELEM_DATA */
737 if (s->flags & (1 << NFTNL_SET_ELEM_CHAIN))
738 - xfree(s->data.chain);
739 + nftnl_xfree(s->data.chain);
741 s->data.chain = strdup(data);
742 if (!s->data.chain)
743 @@ -127,7 +127,7 @@ int nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr,
744 break;
745 case NFTNL_SET_ELEM_USERDATA: /* NFTA_SET_ELEM_USERDATA */
746 if (s->flags & (1 << NFTNL_SET_ELEM_USERDATA))
747 - xfree(s->user.data);
748 + nftnl_xfree(s->user.data);
750 s->user.data = malloc(data_len);
751 if (!s->user.data)
752 @@ -137,7 +137,7 @@ int nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr,
753 break;
754 case NFTNL_SET_ELEM_OBJREF:
755 if (s->flags & (1 << NFTNL_SET_ELEM_OBJREF))
756 - xfree(s->objref);
757 + nftnl_xfree(s->objref);
759 s->objref = strdup(data);
760 if (!s->objref)
761 @@ -431,7 +431,7 @@ static int nftnl_set_elems_parse2(struct nftnl_set *s, const struct nlattr *nest
762 mnl_attr_get_payload(tb[NFTA_SET_ELEM_USERDATA]);
764 if (e->flags & (1 << NFTNL_RULE_USERDATA))
765 - xfree(e->user.data);
766 + nftnl_xfree(e->user.data);
768 e->user.len = mnl_attr_get_payload_len(tb[NFTA_SET_ELEM_USERDATA]);
769 e->user.data = malloc(e->user.len);
770 @@ -515,7 +515,7 @@ int nftnl_set_elems_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s)
772 if (tb[NFTA_SET_ELEM_LIST_TABLE]) {
773 if (s->flags & (1 << NFTNL_SET_TABLE))
774 - xfree(s->table);
775 + nftnl_xfree(s->table);
776 s->table =
777 strdup(mnl_attr_get_str(tb[NFTA_SET_ELEM_LIST_TABLE]));
778 if (!s->table)
779 @@ -524,7 +524,7 @@ int nftnl_set_elems_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s)
781 if (tb[NFTA_SET_ELEM_LIST_SET]) {
782 if (s->flags & (1 << NFTNL_SET_NAME))
783 - xfree(s->name);
784 + nftnl_xfree(s->name);
785 s->name =
786 strdup(mnl_attr_get_str(tb[NFTA_SET_ELEM_LIST_SET]));
787 if (!s->name)
788 @@ -810,7 +810,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_set_elems_iter_next, nft_set_elems_iter_next);
790 void nftnl_set_elems_iter_destroy(struct nftnl_set_elems_iter *iter)
792 - xfree(iter);
793 + nftnl_xfree(iter);
795 EXPORT_SYMBOL_ALIAS(nftnl_set_elems_iter_destroy, nft_set_elems_iter_destroy);
797 diff --git a/src/table.c b/src/table.c
798 index 4286d51..1e15ea7 100644
799 --- a/src/table.c
800 +++ b/src/table.c
801 @@ -45,9 +45,9 @@ EXPORT_SYMBOL_ALIAS(nftnl_table_alloc, nft_table_alloc);
802 void nftnl_table_free(const struct nftnl_table *t)
804 if (t->flags & (1 << NFTNL_TABLE_NAME))
805 - xfree(t->name);
806 + nftnl_xfree(t->name);
808 - xfree(t);
809 + nftnl_xfree(t);
811 EXPORT_SYMBOL_ALIAS(nftnl_table_free, nft_table_free);
813 @@ -64,7 +64,7 @@ void nftnl_table_unset(struct nftnl_table *t, uint16_t attr)
815 switch (attr) {
816 case NFTNL_TABLE_NAME:
817 - xfree(t->name);
818 + nftnl_xfree(t->name);
819 break;
820 case NFTNL_TABLE_FLAGS:
821 case NFTNL_TABLE_FAMILY:
822 @@ -90,7 +90,7 @@ int nftnl_table_set_data(struct nftnl_table *t, uint16_t attr,
823 switch (attr) {
824 case NFTNL_TABLE_NAME:
825 if (t->flags & (1 << NFTNL_TABLE_NAME))
826 - xfree(t->name);
827 + nftnl_xfree(t->name);
829 t->name = strdup(data);
830 if (!t->name)
831 @@ -229,7 +229,7 @@ int nftnl_table_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_table *t)
833 if (tb[NFTA_TABLE_NAME]) {
834 if (t->flags & (1 << NFTNL_TABLE_NAME))
835 - xfree(t->name);
836 + nftnl_xfree(t->name);
837 t->name = strdup(mnl_attr_get_str(tb[NFTA_TABLE_NAME]));
838 if (!t->name)
839 return -1;
840 @@ -448,7 +448,7 @@ void nftnl_table_list_free(struct nftnl_table_list *list)
841 list_del(&r->head);
842 nftnl_table_free(r);
844 - xfree(list);
845 + nftnl_xfree(list);
847 EXPORT_SYMBOL_ALIAS(nftnl_table_list_free, nft_table_list_free);
849 @@ -534,6 +534,6 @@ EXPORT_SYMBOL_ALIAS(nftnl_table_list_iter_next, nft_table_list_iter_next);
851 void nftnl_table_list_iter_destroy(const struct nftnl_table_list_iter *iter)
853 - xfree(iter);
854 + nftnl_xfree(iter);
856 EXPORT_SYMBOL_ALIAS(nftnl_table_list_iter_destroy, nft_table_list_iter_destroy);
857 diff --git a/src/trace.c b/src/trace.c
858 index bd05d3c..abfc533 100644
859 --- a/src/trace.c
860 +++ b/src/trace.c
861 @@ -61,13 +61,13 @@ struct nftnl_trace *nftnl_trace_alloc(void)
862 EXPORT_SYMBOL(nftnl_trace_free);
863 void nftnl_trace_free(const struct nftnl_trace *t)
865 - xfree(t->chain);
866 - xfree(t->table);
867 - xfree(t->jump_target);
868 - xfree(t->ll.data);
869 - xfree(t->nh.data);
870 - xfree(t->th.data);
871 - xfree(t);
872 + nftnl_xfree(t->chain);
873 + nftnl_xfree(t->table);
874 + nftnl_xfree(t->jump_target);
875 + nftnl_xfree(t->ll.data);
876 + nftnl_xfree(t->nh.data);
877 + nftnl_xfree(t->th.data);
878 + nftnl_xfree(t);
881 EXPORT_SYMBOL(nftnl_trace_is_set);
882 diff --git a/src/udata.c b/src/udata.c
883 index 60c2f34..ec1f7dc 100644
884 --- a/src/udata.c
885 +++ b/src/udata.c
886 @@ -32,7 +32,7 @@ EXPORT_SYMBOL(nftnl_udata_buf_alloc);
888 void nftnl_udata_buf_free(const struct nftnl_udata_buf *buf)
890 - xfree(buf);
891 + nftnl_xfree(buf);
893 EXPORT_SYMBOL(nftnl_udata_buf_free);
895 diff --git a/src/utils.c b/src/utils.c
896 index 3e44960..08f668f 100644
897 --- a/src/utils.c
898 +++ b/src/utils.c
899 @@ -264,7 +264,7 @@ int nftnl_fprintf(FILE *fp, const void *obj, uint32_t cmd, uint32_t type,
901 out:
902 if (buf != _buf)
903 - xfree(buf);
904 + nftnl_xfree(buf);
906 return ret;
909 2.10.2