summaryrefslogtreecommitdiff
path: root/package/libnftnl/0001-Rename-xfree-to-libnftnl_xfree-to-avoid-symbol-namin.patch
blob: 6f5be4e7ef0240b4b93311798646220d550207fc (plain)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
From 610d015143e88629eab07067a4ae0c1d7548cfaf Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Thu, 2 Jun 2016 23:03:27 -0300
Subject: [PATCH] Rename xfree() to libnftnl_xfree() to avoid symbol naming
 conflict

When ELF binaries and shared libraries are used, the internal
functions of libnftnl such as xfree() are not visible to the outside
world (their visibility is 'hidden'). Therefore, the fact that other
programs (especially nftables) may have symbols with the same name
does not cause any problem.

However, when doing static linking on a non-ELF platform (such as
Blackfin, which uses the FLAT binary format), there is no way of
encoding this visibility. Therefore, the xfree() symbols of libnftnl
becomes visible to the outside world, causing a conflict with the
xfree() symbol defined by nftables.

To solve this, this patch renames the libnftnl xfree() function to
libnftnl_xfree().

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[Gustavo: update for version 1.0.7]
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
---
 include/utils.h      |  2 +-
 src/chain.c          | 36 ++++++++++++++++++------------------
 src/common.c         |  2 +-
 src/expr.c           |  4 ++--
 src/expr/data_reg.c  |  2 +-
 src/expr/dynset.c    |  2 +-
 src/expr/immediate.c |  2 +-
 src/expr/log.c       |  6 +++---
 src/expr/lookup.c    |  2 +-
 src/expr/match.c     |  6 +++---
 src/expr/target.c    |  6 +++---
 src/gen.c            |  2 +-
 src/object.c         | 14 +++++++-------
 src/rule.c           | 32 ++++++++++++++++----------------
 src/ruleset.c        |  2 +-
 src/set.c            | 26 +++++++++++++-------------
 src/set_elem.c       | 28 ++++++++++++++--------------
 src/table.c          | 14 +++++++-------
 src/trace.c          | 14 +++++++-------
 src/udata.c          |  2 +-
 src/utils.c          |  2 +-
 21 files changed, 103 insertions(+), 103 deletions(-)

diff --git a/include/utils.h b/include/utils.h
index 924df32..f02fce7 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -19,7 +19,7 @@
 
 #define __noreturn	__attribute__((__noreturn__))
 
-#define xfree(ptr)	free((void *)ptr);
+#define nftnl_xfree(ptr)	free((void *)ptr);
 
 #define div_round_up(n, d)	(((n) + (d) - 1) / (d))
 
diff --git a/src/chain.c b/src/chain.c
index 49cd094..444cb79 100644
--- a/src/chain.c
+++ b/src/chain.c
@@ -96,14 +96,14 @@ EXPORT_SYMBOL_ALIAS(nftnl_chain_alloc, nft_chain_alloc);
 void nftnl_chain_free(const struct nftnl_chain *c)
 {
 	if (c->flags & (1 << NFTNL_CHAIN_NAME))
-		xfree(c->name);
+		nftnl_xfree(c->name);
 	if (c->flags & (1 << NFTNL_CHAIN_TABLE))
-		xfree(c->table);
+		nftnl_xfree(c->table);
 	if (c->flags & (1 << NFTNL_CHAIN_TYPE))
-		xfree(c->type);
+		nftnl_xfree(c->type);
 	if (c->flags & (1 << NFTNL_CHAIN_DEV))
-		xfree(c->dev);
-	xfree(c);
+		nftnl_xfree(c->dev);
+	nftnl_xfree(c);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_chain_free, nft_chain_free);
 
@@ -120,15 +120,15 @@ void nftnl_chain_unset(struct nftnl_chain *c, uint16_t attr)
 
 	switch (attr) {
 	case NFTNL_CHAIN_NAME:
-		xfree(c->name);
+		nftnl_xfree(c->name);
 		break;
 	case NFTNL_CHAIN_TABLE:
-		xfree(c->table);
+		nftnl_xfree(c->table);
 		break;
 	case NFTNL_CHAIN_USE:
 		break;
 	case NFTNL_CHAIN_TYPE:
-		xfree(c->type);
+		nftnl_xfree(c->type);
 		break;
 	case NFTNL_CHAIN_HOOKNUM:
 	case NFTNL_CHAIN_PRIO:
@@ -139,7 +139,7 @@ void nftnl_chain_unset(struct nftnl_chain *c, uint16_t attr)
 	case NFTNL_CHAIN_FAMILY:
 		break;
 	case NFTNL_CHAIN_DEV:
-		xfree(c->dev);
+		nftnl_xfree(c->dev);
 		break;
 	default:
 		return;
@@ -168,7 +168,7 @@ int nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
 	switch(attr) {
 	case NFTNL_CHAIN_NAME:
 		if (c->flags & (1 << NFTNL_CHAIN_NAME))
-			xfree(c->name);
+			nftnl_xfree(c->name);
 
 		c->name = strdup(data);
 		if (!c->name)
@@ -176,7 +176,7 @@ int nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
 		break;
 	case NFTNL_CHAIN_TABLE:
 		if (c->flags & (1 << NFTNL_CHAIN_TABLE))
-			xfree(c->table);
+			nftnl_xfree(c->table);
 
 		c->table = strdup(data);
 		if (!c->table)
@@ -208,7 +208,7 @@ int nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
 		break;
 	case NFTNL_CHAIN_TYPE:
 		if (c->flags & (1 << NFTNL_CHAIN_TYPE))
-			xfree(c->type);
+			nftnl_xfree(c->type);
 
 		c->type = strdup(data);
 		if (!c->type)
@@ -216,7 +216,7 @@ int nftnl_chain_set_data(struct nftnl_chain *c, uint16_t attr,
 		break;
 	case NFTNL_CHAIN_DEV:
 		if (c->flags & (1 << NFTNL_CHAIN_DEV))
-			xfree(c->dev);
+			nftnl_xfree(c->dev);
 
 		c->dev = strdup(data);
 		if (!c->dev)
@@ -540,7 +540,7 @@ int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *c)
 
 	if (tb[NFTA_CHAIN_NAME]) {
 		if (c->flags & (1 << NFTNL_CHAIN_NAME))
-			xfree(c->name);
+			nftnl_xfree(c->name);
 		c->name = strdup(mnl_attr_get_str(tb[NFTA_CHAIN_NAME]));
 		if (!c->name)
 			return -1;
@@ -548,7 +548,7 @@ int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *c)
 	}
 	if (tb[NFTA_CHAIN_TABLE]) {
 		if (c->flags & (1 << NFTNL_CHAIN_TABLE))
-			xfree(c->table);
+			nftnl_xfree(c->table);
 		c->table = strdup(mnl_attr_get_str(tb[NFTA_CHAIN_TABLE]));
 		if (!c->table)
 			return -1;
@@ -578,7 +578,7 @@ int nftnl_chain_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_chain *c)
 	}
 	if (tb[NFTA_CHAIN_TYPE]) {
 		if (c->flags & (1 << NFTNL_CHAIN_TYPE))
-			xfree(c->type);
+			nftnl_xfree(c->type);
 		c->type = strdup(mnl_attr_get_str(tb[NFTA_CHAIN_TYPE]));
 		if (!c->type)
 			return -1;
@@ -889,7 +889,7 @@ void nftnl_chain_list_free(struct nftnl_chain_list *list)
 		list_del(&r->head);
 		nftnl_chain_free(r);
 	}
-	xfree(list);
+	nftnl_xfree(list);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_chain_list_free, nft_chain_list_free);
 
@@ -975,6 +975,6 @@ EXPORT_SYMBOL_ALIAS(nftnl_chain_list_iter_next, nft_chain_list_iter_next);
 
 void nftnl_chain_list_iter_destroy(struct nftnl_chain_list_iter *iter)
 {
-	xfree(iter);
+	nftnl_xfree(iter);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_chain_list_iter_destroy, nft_chain_list_iter_destroy);
diff --git a/src/common.c b/src/common.c
index bf4176c..98f8012 100644
--- a/src/common.c
+++ b/src/common.c
@@ -58,7 +58,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_parse_err_alloc, nft_parse_err_alloc);
 
 void nftnl_parse_err_free(struct nftnl_parse_err *err)
 {
-	xfree(err);
+	nftnl_xfree(err);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_parse_err_free, nft_parse_err_free);
 
diff --git a/src/expr.c b/src/expr.c
index 8d5c562..47ecd3d 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -50,7 +50,7 @@ void nftnl_expr_free(const struct nftnl_expr *expr)
 	if (expr->ops->free)
 		expr->ops->free(expr);
 
-	xfree(expr);
+	nftnl_xfree(expr);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_expr_free, nft_rule_expr_free);
 
@@ -270,7 +270,7 @@ struct nftnl_expr *nftnl_expr_parse(struct nlattr *attr)
 	return expr;
 
 err2:
-	xfree(expr);
+	nftnl_xfree(expr);
 err1:
 	return NULL;
 }
diff --git a/src/expr/data_reg.c b/src/expr/data_reg.c
index 0249258..994b388 100644
--- a/src/expr/data_reg.c
+++ b/src/expr/data_reg.c
@@ -376,7 +376,7 @@ void nftnl_free_verdict(const union nftnl_data_reg *data)
 	switch(data->verdict) {
 	case NFT_JUMP:
 	case NFT_GOTO:
-		xfree(data->chain);
+		nftnl_xfree(data->chain);
 		break;
 	default:
 		break;
diff --git a/src/expr/dynset.c b/src/expr/dynset.c
index 20a5004..f3d46a7 100644
--- a/src/expr/dynset.c
+++ b/src/expr/dynset.c
@@ -330,7 +330,7 @@ static void nftnl_expr_dynset_free(const struct nftnl_expr *e)
 {
 	struct nftnl_expr_dynset *dynset = nftnl_expr_data(e);
 
-	xfree(dynset->set_name);
+	nftnl_xfree(dynset->set_name);
 }
 
 static bool nftnl_expr_dynset_cmp(const struct nftnl_expr *e1,
diff --git a/src/expr/immediate.c b/src/expr/immediate.c
index 0b188cc..6c17f68 100644
--- a/src/expr/immediate.c
+++ b/src/expr/immediate.c
@@ -44,7 +44,7 @@ nftnl_expr_immediate_set(struct nftnl_expr *e, uint16_t type,
 		break;
 	case NFTNL_EXPR_IMM_CHAIN:
 		if (e->flags & (1 << NFTNL_EXPR_IMM_CHAIN))
-			xfree(imm->data.chain);
+			nftnl_xfree(imm->data.chain);
 
 		imm->data.chain = strdup(data);
 		if (!imm->data.chain)
diff --git a/src/expr/log.c b/src/expr/log.c
index b642255..2b24b6d 100644
--- a/src/expr/log.c
+++ b/src/expr/log.c
@@ -39,7 +39,7 @@ static int nftnl_expr_log_set(struct nftnl_expr *e, uint16_t type,
 	switch(type) {
 	case NFTNL_EXPR_LOG_PREFIX:
 		if (log->flags & (1 << NFTNL_EXPR_LOG_PREFIX))
-			xfree(log->prefix);
+			nftnl_xfree(log->prefix);
 
 		log->prefix = strdup(data);
 		if (!log->prefix)
@@ -155,7 +155,7 @@ nftnl_expr_log_parse(struct nftnl_expr *e, struct nlattr *attr)
 
 	if (tb[NFTA_LOG_PREFIX]) {
 		if (log->prefix)
-			xfree(log->prefix);
+			nftnl_xfree(log->prefix);
 
 		log->prefix = strdup(mnl_attr_get_str(tb[NFTA_LOG_PREFIX]));
 		if (!log->prefix)
@@ -316,7 +316,7 @@ static void nftnl_expr_log_free(const struct nftnl_expr *e)
 {
 	struct nftnl_expr_log *log = nftnl_expr_data(e);
 
-	xfree(log->prefix);
+	nftnl_xfree(log->prefix);
 }
 
 static bool nftnl_expr_log_cmp(const struct nftnl_expr *e1,
diff --git a/src/expr/lookup.c b/src/expr/lookup.c
index 861815f..1955ed3 100644
--- a/src/expr/lookup.c
+++ b/src/expr/lookup.c
@@ -259,7 +259,7 @@ static void nftnl_expr_lookup_free(const struct nftnl_expr *e)
 {
 	struct nftnl_expr_lookup *lookup = nftnl_expr_data(e);
 
-	xfree(lookup->set_name);
+	nftnl_xfree(lookup->set_name);
 }
 
 static bool nftnl_expr_lookup_cmp(const struct nftnl_expr *e1,
diff --git a/src/expr/match.c b/src/expr/match.c
index dd09e1e..09e35c5 100644
--- a/src/expr/match.c
+++ b/src/expr/match.c
@@ -50,7 +50,7 @@ nftnl_expr_match_set(struct nftnl_expr *e, uint16_t type,
 		break;
 	case NFTNL_EXPR_MT_INFO:
 		if (e->flags & (1 << NFTNL_EXPR_MT_INFO))
-			xfree(mt->data);
+			nftnl_xfree(mt->data);
 
 		mt->data = data;
 		mt->data_len = data_len;
@@ -147,7 +147,7 @@ static int nftnl_expr_match_parse(struct nftnl_expr *e, struct nlattr *attr)
 		void *match_data;
 
 		if (e->flags & (1 << NFTNL_EXPR_MT_INFO))
-			xfree(match->data);
+			nftnl_xfree(match->data);
 
 		match_data = calloc(1, len);
 		if (match_data == NULL)
@@ -217,7 +217,7 @@ static void nftnl_expr_match_free(const struct nftnl_expr *e)
 {
 	struct nftnl_expr_match *match = nftnl_expr_data(e);
 
-	xfree(match->data);
+	nftnl_xfree(match->data);
 }
 
 static bool nftnl_expr_match_cmp(const struct nftnl_expr *e1,
diff --git a/src/expr/target.c b/src/expr/target.c
index ed4bf7d..5e28925 100644
--- a/src/expr/target.c
+++ b/src/expr/target.c
@@ -50,7 +50,7 @@ nftnl_expr_target_set(struct nftnl_expr *e, uint16_t type,
 		break;
 	case NFTNL_EXPR_TG_INFO:
 		if (e->flags & (1 << NFTNL_EXPR_TG_INFO))
-			xfree(tg->data);
+			nftnl_xfree(tg->data);
 
 		tg->data = data;
 		tg->data_len = data_len;
@@ -147,7 +147,7 @@ static int nftnl_expr_target_parse(struct nftnl_expr *e, struct nlattr *attr)
 		void *target_data;
 
 		if (target->data)
-			xfree(target->data);
+			nftnl_xfree(target->data);
 
 		target_data = calloc(1, len);
 		if (target_data == NULL)
@@ -217,7 +217,7 @@ static void nftnl_expr_target_free(const struct nftnl_expr *e)
 {
 	struct nftnl_expr_target *target = nftnl_expr_data(e);
 
-	xfree(target->data);
+	nftnl_xfree(target->data);
 }
 
 static bool nftnl_expr_target_cmp(const struct nftnl_expr *e1,
diff --git a/src/gen.c b/src/gen.c
index c69d2f8..0143ea0 100644
--- a/src/gen.c
+++ b/src/gen.c
@@ -37,7 +37,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_gen_alloc, nft_gen_alloc);
 
 void nftnl_gen_free(const struct nftnl_gen *gen)
 {
-	xfree(gen);
+	nftnl_xfree(gen);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_gen_free, nft_gen_free);
 
diff --git a/src/object.c b/src/object.c
index 0d3dc2b..542211c 100644
--- a/src/object.c
+++ b/src/object.c
@@ -47,11 +47,11 @@ EXPORT_SYMBOL(nftnl_obj_alloc);
 void nftnl_obj_free(const struct nftnl_obj *obj)
 {
 	if (obj->flags & (1 << NFTNL_OBJ_TABLE))
-		xfree(obj->table);
+		nftnl_xfree(obj->table);
 	if (obj->flags & (1 << NFTNL_OBJ_NAME))
-		xfree(obj->name);
+		nftnl_xfree(obj->name);
 
-	xfree(obj);
+	nftnl_xfree(obj);
 }
 EXPORT_SYMBOL(nftnl_obj_free);
 
@@ -74,11 +74,11 @@ void nftnl_obj_set_data(struct nftnl_obj *obj, uint16_t attr,
 
 	switch (attr) {
 	case NFTNL_OBJ_TABLE:
-		xfree(obj->table);
+		nftnl_xfree(obj->table);
 		obj->table = strdup(data);
 		break;
 	case NFTNL_OBJ_NAME:
-		xfree(obj->name);
+		nftnl_xfree(obj->name);
 		obj->name = strdup(data);
 		break;
 	case NFTNL_OBJ_TYPE:
@@ -486,7 +486,7 @@ void nftnl_obj_list_free(struct nftnl_obj_list *list)
 		list_del(&r->head);
 		nftnl_obj_free(r);
 	}
-	xfree(list);
+	nftnl_xfree(list);
 }
 EXPORT_SYMBOL(nftnl_obj_list_free);
 
@@ -573,6 +573,6 @@ EXPORT_SYMBOL(nftnl_obj_list_iter_next);
 
 void nftnl_obj_list_iter_destroy(struct nftnl_obj_list_iter *iter)
 {
-	xfree(iter);
+	nftnl_xfree(iter);
 }
 EXPORT_SYMBOL(nftnl_obj_list_iter_destroy);
diff --git a/src/rule.c b/src/rule.c
index 22026a4..256b699 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -72,13 +72,13 @@ void nftnl_rule_free(const struct nftnl_rule *r)
 		nftnl_expr_free(e);
 
 	if (r->flags & (1 << (NFTNL_RULE_TABLE)))
-		xfree(r->table);
+		nftnl_xfree(r->table);
 	if (r->flags & (1 << (NFTNL_RULE_CHAIN)))
-		xfree(r->chain);
+		nftnl_xfree(r->chain);
 	if (r->flags & (1 << (NFTNL_RULE_USERDATA)))
-		xfree(r->user.data);
+		nftnl_xfree(r->user.data);
 
-	xfree(r);
+	nftnl_xfree(r);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_rule_free, nft_rule_free);
 
@@ -95,10 +95,10 @@ void nftnl_rule_unset(struct nftnl_rule *r, uint16_t attr)
 
 	switch (attr) {
 	case NFTNL_RULE_TABLE:
-		xfree(r->table);
+		nftnl_xfree(r->table);
 		break;
 	case NFTNL_RULE_CHAIN:
-		xfree(r->chain);
+		nftnl_xfree(r->chain);
 		break;
 	case NFTNL_RULE_HANDLE:
 	case NFTNL_RULE_COMPAT_PROTO:
@@ -107,7 +107,7 @@ void nftnl_rule_unset(struct nftnl_rule *r, uint16_t attr)
 	case NFTNL_RULE_FAMILY:
 		break;
 	case NFTNL_RULE_USERDATA:
-		xfree(r->user.data);
+		nftnl_xfree(r->user.data);
 		break;
 	}
 
@@ -132,7 +132,7 @@ int nftnl_rule_set_data(struct nftnl_rule *r, uint16_t attr,
 	switch(attr) {
 	case NFTNL_RULE_TABLE:
 		if (r->flags & (1 << NFTNL_RULE_TABLE))
-			xfree(r->table);
+			nftnl_xfree(r->table);
 
 		r->table = strdup(data);
 		if (!r->table)
@@ -140,7 +140,7 @@ int nftnl_rule_set_data(struct nftnl_rule *r, uint16_t attr,
 		break;
 	case NFTNL_RULE_CHAIN:
 		if (r->flags & (1 << NFTNL_RULE_CHAIN))
-			xfree(r->chain);
+			nftnl_xfree(r->chain);
 
 		r->chain = strdup(data);
 		if (!r->chain)
@@ -163,7 +163,7 @@ int nftnl_rule_set_data(struct nftnl_rule *r, uint16_t attr,
 		break;
 	case NFTNL_RULE_USERDATA:
 		if (r->flags & (1 << NFTNL_RULE_USERDATA))
-			xfree(r->user.data);
+			nftnl_xfree(r->user.data);
 
 		r->user.data = malloc(data_len);
 		if (!r->user.data)
@@ -436,7 +436,7 @@ int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r)
 
 	if (tb[NFTA_RULE_TABLE]) {
 		if (r->flags & (1 << NFTNL_RULE_TABLE))
-			xfree(r->table);
+			nftnl_xfree(r->table);
 		r->table = strdup(mnl_attr_get_str(tb[NFTA_RULE_TABLE]));
 		if (!r->table)
 			return -1;
@@ -444,7 +444,7 @@ int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r)
 	}
 	if (tb[NFTA_RULE_CHAIN]) {
 		if (r->flags & (1 << NFTNL_RULE_CHAIN))
-			xfree(r->chain);
+			nftnl_xfree(r->chain);
 		r->chain = strdup(mnl_attr_get_str(tb[NFTA_RULE_CHAIN]));
 		if (!r->chain)
 			return -1;
@@ -473,7 +473,7 @@ int nftnl_rule_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_rule *r)
 			mnl_attr_get_payload(tb[NFTA_RULE_USERDATA]);
 
 		if (r->flags & (1 << NFTNL_RULE_USERDATA))
-			xfree(r->user.data);
+			nftnl_xfree(r->user.data);
 
 		r->user.len = mnl_attr_get_payload_len(tb[NFTA_RULE_USERDATA]);
 
@@ -915,7 +915,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_expr_iter_next, nft_rule_expr_iter_next);
 
 void nftnl_expr_iter_destroy(struct nftnl_expr_iter *iter)
 {
-	xfree(iter);
+	nftnl_xfree(iter);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_expr_iter_destroy, nft_rule_expr_iter_destroy);
 
@@ -976,7 +976,7 @@ void nftnl_rule_list_free(struct nftnl_rule_list *list)
 		list_del(&r->head);
 		nftnl_rule_free(r);
 	}
-	xfree(list);
+	nftnl_xfree(list);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_rule_list_free, nft_rule_list_free);
 
@@ -1068,6 +1068,6 @@ EXPORT_SYMBOL_ALIAS(nftnl_rule_list_iter_next, nft_rule_list_iter_next);
 
 void nftnl_rule_list_iter_destroy(const struct nftnl_rule_list_iter *iter)
 {
-	xfree(iter);
+	nftnl_xfree(iter);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_rule_list_iter_destroy, nft_rule_list_iter_destroy);
diff --git a/src/ruleset.c b/src/ruleset.c
index b6ca565..0867e2a 100644
--- a/src/ruleset.c
+++ b/src/ruleset.c
@@ -71,7 +71,7 @@ void nftnl_ruleset_free(const struct nftnl_ruleset *r)
 		nftnl_set_list_free(r->set_list);
 	if (r->flags & (1 << NFTNL_RULESET_RULELIST))
 		nftnl_rule_list_free(r->rule_list);
-	xfree(r);
+	nftnl_xfree(r);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_ruleset_free, nft_ruleset_free);
 
diff --git a/src/set.c b/src/set.c
index 14d28b5..0e93503 100644
--- a/src/set.c
+++ b/src/set.c
@@ -45,15 +45,15 @@ void nftnl_set_free(const struct nftnl_set *s)
 	struct nftnl_set_elem *elem, *tmp;
 
 	if (s->flags & (1 << NFTNL_SET_TABLE))
-		xfree(s->table);
+		nftnl_xfree(s->table);
 	if (s->flags & (1 << NFTNL_SET_NAME))
-		xfree(s->name);
+		nftnl_xfree(s->name);
 
 	list_for_each_entry_safe(elem, tmp, &s->element_list, head) {
 		list_del(&elem->head);
 		nftnl_set_elem_free(elem);
 	}
-	xfree(s);
+	nftnl_xfree(s);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_set_free, nft_set_free);
 
@@ -70,10 +70,10 @@ void nftnl_set_unset(struct nftnl_set *s, uint16_t attr)
 
 	switch (attr) {
 	case NFTNL_SET_TABLE:
-		xfree(s->table);
+		nftnl_xfree(s->table);
 		break;
 	case NFTNL_SET_NAME:
-		xfree(s->name);
+		nftnl_xfree(s->name);
 		break;
 	case NFTNL_SET_FLAGS:
 	case NFTNL_SET_KEY_TYPE:
@@ -89,7 +89,7 @@ void nftnl_set_unset(struct nftnl_set *s, uint16_t attr)
 	case NFTNL_SET_GC_INTERVAL:
 		break;
 	case NFTNL_SET_USERDATA:
-		xfree(s->user.data);
+		nftnl_xfree(s->user.data);
 		break;
 	default:
 		return;
@@ -122,7 +122,7 @@ int nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data,
 	switch(attr) {
 	case NFTNL_SET_TABLE:
 		if (s->flags & (1 << NFTNL_SET_TABLE))
-			xfree(s->table);
+			nftnl_xfree(s->table);
 
 		s->table = strdup(data);
 		if (!s->table)
@@ -130,7 +130,7 @@ int nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data,
 		break;
 	case NFTNL_SET_NAME:
 		if (s->flags & (1 << NFTNL_SET_NAME))
-			xfree(s->name);
+			nftnl_xfree(s->name);
 
 		s->name = strdup(data);
 		if (!s->name)
@@ -174,7 +174,7 @@ int nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data,
 		break;
 	case NFTNL_SET_USERDATA:
 		if (s->flags & (1 << NFTNL_SET_USERDATA))
-			xfree(s->user.data);
+			nftnl_xfree(s->user.data);
 
 		s->user.data = malloc(data_len);
 		if (!s->user.data)
@@ -474,7 +474,7 @@ int nftnl_set_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s)
 
 	if (tb[NFTA_SET_TABLE]) {
 		if (s->flags & (1 << NFTNL_SET_TABLE))
-			xfree(s->table);
+			nftnl_xfree(s->table);
 		s->table = strdup(mnl_attr_get_str(tb[NFTA_SET_TABLE]));
 		if (!s->table)
 			return -1;
@@ -482,7 +482,7 @@ int nftnl_set_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s)
 	}
 	if (tb[NFTA_SET_NAME]) {
 		if (s->flags & (1 << NFTNL_SET_NAME))
-			xfree(s->name);
+			nftnl_xfree(s->name);
 		s->name = strdup(mnl_attr_get_str(tb[NFTA_SET_NAME]));
 		if (!s->name)
 			return -1;
@@ -972,7 +972,7 @@ void nftnl_set_list_free(struct nftnl_set_list *list)
 		list_del(&s->head);
 		nftnl_set_free(s);
 	}
-	xfree(list);
+	nftnl_xfree(list);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_set_list_free, nft_set_list_free);
 
@@ -1064,7 +1064,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_set_list_iter_next, nft_set_list_iter_next);
 
 void nftnl_set_list_iter_destroy(const struct nftnl_set_list_iter *iter)
 {
-	xfree(iter);
+	nftnl_xfree(iter);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_set_list_iter_destroy, nft_set_list_iter_destroy);
 
diff --git a/src/set_elem.c b/src/set_elem.c
index fa87476..6d404bd 100644
--- a/src/set_elem.c
+++ b/src/set_elem.c
@@ -42,18 +42,18 @@ EXPORT_SYMBOL_ALIAS(nftnl_set_elem_alloc, nft_set_elem_alloc);
 void nftnl_set_elem_free(struct nftnl_set_elem *s)
 {
 	if (s->flags & (1 << NFTNL_SET_ELEM_CHAIN))
-		xfree(s->data.chain);
+		nftnl_xfree(s->data.chain);
 
 	if (s->flags & (1 << NFTNL_SET_ELEM_EXPR))
 		nftnl_expr_free(s->expr);
 
 	if (s->flags & (1 << NFTNL_SET_ELEM_USERDATA))
-		xfree(s->user.data);
+		nftnl_xfree(s->user.data);
 
 	if (s->flags & (1 << NFTNL_SET_ELEM_OBJREF))
-		xfree(s->objref);
+		nftnl_xfree(s->objref);
 
-	xfree(s);
+	nftnl_xfree(s);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_set_elem_free, nft_set_elem_free);
 
@@ -70,7 +70,7 @@ void nftnl_set_elem_unset(struct nftnl_set_elem *s, uint16_t attr)
 
 	switch (attr) {
 	case NFTNL_SET_ELEM_CHAIN:
-		xfree(s->data.chain);
+		nftnl_xfree(s->data.chain);
 		break;
 	case NFTNL_SET_ELEM_FLAGS:
 	case NFTNL_SET_ELEM_KEY:	/* NFTA_SET_ELEM_KEY */
@@ -80,13 +80,13 @@ void nftnl_set_elem_unset(struct nftnl_set_elem *s, uint16_t attr)
 	case NFTNL_SET_ELEM_EXPIRATION:	/* NFTA_SET_ELEM_EXPIRATION */
 		break;
 	case NFTNL_SET_ELEM_USERDATA:	/* NFTA_SET_ELEM_USERDATA */
-		xfree(s->user.data);
+		nftnl_xfree(s->user.data);
 		break;
 	case NFTNL_SET_ELEM_EXPR:
 		nftnl_expr_free(s->expr);
 		break;
 	case NFTNL_SET_ELEM_OBJREF:
-		xfree(s->objref);
+		nftnl_xfree(s->objref);
 		break;
 	default:
 		return;
@@ -112,7 +112,7 @@ int nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr,
 		break;
 	case NFTNL_SET_ELEM_CHAIN:	/* NFTA_SET_ELEM_DATA */
 		if (s->flags & (1 << NFTNL_SET_ELEM_CHAIN))
-			xfree(s->data.chain);
+			nftnl_xfree(s->data.chain);
 
 		s->data.chain = strdup(data);
 		if (!s->data.chain)
@@ -127,7 +127,7 @@ int nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr,
 		break;
 	case NFTNL_SET_ELEM_USERDATA: /* NFTA_SET_ELEM_USERDATA */
 		if (s->flags & (1 << NFTNL_SET_ELEM_USERDATA))
-			xfree(s->user.data);
+			nftnl_xfree(s->user.data);
 
 		s->user.data = malloc(data_len);
 		if (!s->user.data)
@@ -137,7 +137,7 @@ int nftnl_set_elem_set(struct nftnl_set_elem *s, uint16_t attr,
 		break;
 	case NFTNL_SET_ELEM_OBJREF:
 		if (s->flags & (1 << NFTNL_SET_ELEM_OBJREF))
-			xfree(s->objref);
+			nftnl_xfree(s->objref);
 
 		s->objref = strdup(data);
 		if (!s->objref)
@@ -431,7 +431,7 @@ static int nftnl_set_elems_parse2(struct nftnl_set *s, const struct nlattr *nest
 			mnl_attr_get_payload(tb[NFTA_SET_ELEM_USERDATA]);
 
 		if (e->flags & (1 << NFTNL_RULE_USERDATA))
-			xfree(e->user.data);
+			nftnl_xfree(e->user.data);
 
 		e->user.len  = mnl_attr_get_payload_len(tb[NFTA_SET_ELEM_USERDATA]);
 		e->user.data = malloc(e->user.len);
@@ -515,7 +515,7 @@ int nftnl_set_elems_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s)
 
 	if (tb[NFTA_SET_ELEM_LIST_TABLE]) {
 		if (s->flags & (1 << NFTNL_SET_TABLE))
-			xfree(s->table);
+			nftnl_xfree(s->table);
 		s->table =
 			strdup(mnl_attr_get_str(tb[NFTA_SET_ELEM_LIST_TABLE]));
 		if (!s->table)
@@ -524,7 +524,7 @@ int nftnl_set_elems_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_set *s)
 	}
 	if (tb[NFTA_SET_ELEM_LIST_SET]) {
 		if (s->flags & (1 << NFTNL_SET_NAME))
-			xfree(s->name);
+			nftnl_xfree(s->name);
 		s->name =
 			strdup(mnl_attr_get_str(tb[NFTA_SET_ELEM_LIST_SET]));
 		if (!s->name)
@@ -810,7 +810,7 @@ EXPORT_SYMBOL_ALIAS(nftnl_set_elems_iter_next, nft_set_elems_iter_next);
 
 void nftnl_set_elems_iter_destroy(struct nftnl_set_elems_iter *iter)
 {
-	xfree(iter);
+	nftnl_xfree(iter);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_set_elems_iter_destroy, nft_set_elems_iter_destroy);
 
diff --git a/src/table.c b/src/table.c
index 4286d51..1e15ea7 100644
--- a/src/table.c
+++ b/src/table.c
@@ -45,9 +45,9 @@ EXPORT_SYMBOL_ALIAS(nftnl_table_alloc, nft_table_alloc);
 void nftnl_table_free(const struct nftnl_table *t)
 {
 	if (t->flags & (1 << NFTNL_TABLE_NAME))
-		xfree(t->name);
+		nftnl_xfree(t->name);
 
-	xfree(t);
+	nftnl_xfree(t);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_table_free, nft_table_free);
 
@@ -64,7 +64,7 @@ void nftnl_table_unset(struct nftnl_table *t, uint16_t attr)
 
 	switch (attr) {
 	case NFTNL_TABLE_NAME:
-		xfree(t->name);
+		nftnl_xfree(t->name);
 		break;
 	case NFTNL_TABLE_FLAGS:
 	case NFTNL_TABLE_FAMILY:
@@ -90,7 +90,7 @@ int nftnl_table_set_data(struct nftnl_table *t, uint16_t attr,
 	switch (attr) {
 	case NFTNL_TABLE_NAME:
 		if (t->flags & (1 << NFTNL_TABLE_NAME))
-			xfree(t->name);
+			nftnl_xfree(t->name);
 
 		t->name = strdup(data);
 		if (!t->name)
@@ -229,7 +229,7 @@ int nftnl_table_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_table *t)
 
 	if (tb[NFTA_TABLE_NAME]) {
 		if (t->flags & (1 << NFTNL_TABLE_NAME))
-			xfree(t->name);
+			nftnl_xfree(t->name);
 		t->name = strdup(mnl_attr_get_str(tb[NFTA_TABLE_NAME]));
 		if (!t->name)
 			return -1;
@@ -448,7 +448,7 @@ void nftnl_table_list_free(struct nftnl_table_list *list)
 		list_del(&r->head);
 		nftnl_table_free(r);
 	}
-	xfree(list);
+	nftnl_xfree(list);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_table_list_free, nft_table_list_free);
 
@@ -534,6 +534,6 @@ EXPORT_SYMBOL_ALIAS(nftnl_table_list_iter_next, nft_table_list_iter_next);
 
 void nftnl_table_list_iter_destroy(const struct nftnl_table_list_iter *iter)
 {
-	xfree(iter);
+	nftnl_xfree(iter);
 }
 EXPORT_SYMBOL_ALIAS(nftnl_table_list_iter_destroy, nft_table_list_iter_destroy);
diff --git a/src/trace.c b/src/trace.c
index bd05d3c..abfc533 100644
--- a/src/trace.c
+++ b/src/trace.c
@@ -61,13 +61,13 @@ struct nftnl_trace *nftnl_trace_alloc(void)
 EXPORT_SYMBOL(nftnl_trace_free);
 void nftnl_trace_free(const struct nftnl_trace *t)
 {
-	xfree(t->chain);
-	xfree(t->table);
-	xfree(t->jump_target);
-	xfree(t->ll.data);
-	xfree(t->nh.data);
-	xfree(t->th.data);
-	xfree(t);
+	nftnl_xfree(t->chain);
+	nftnl_xfree(t->table);
+	nftnl_xfree(t->jump_target);
+	nftnl_xfree(t->ll.data);
+	nftnl_xfree(t->nh.data);
+	nftnl_xfree(t->th.data);
+	nftnl_xfree(t);
 }
 
 EXPORT_SYMBOL(nftnl_trace_is_set);
diff --git a/src/udata.c b/src/udata.c
index 60c2f34..ec1f7dc 100644
--- a/src/udata.c
+++ b/src/udata.c
@@ -32,7 +32,7 @@ EXPORT_SYMBOL(nftnl_udata_buf_alloc);
 
 void nftnl_udata_buf_free(const struct nftnl_udata_buf *buf)
 {
-	xfree(buf);
+	nftnl_xfree(buf);
 }
 EXPORT_SYMBOL(nftnl_udata_buf_free);
 
diff --git a/src/utils.c b/src/utils.c
index 3e44960..08f668f 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -264,7 +264,7 @@ int nftnl_fprintf(FILE *fp, const void *obj, uint32_t cmd, uint32_t type,
 
 out:
 	if (buf != _buf)
-		xfree(buf);
+		nftnl_xfree(buf);
 
 	return ret;
 }
-- 
2.10.2