mem: fix leaks of hugedir and replace snprintf
authorYangchao Zhou <zhouyates@gmail.com>
Wed, 18 Apr 2018 03:09:13 +0000 (11:09 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 18 Apr 2018 08:58:10 +0000 (10:58 +0200)
commitfb338b80e5fa91a0bf726cfa0627a177e01e9483
treee39e1144da6b36d4a0ffaf7fbedfd26e9b7edb22
parent1c9467a6efd8d85b5bbbf7004a4407cae2d09431
mem: fix leaks of hugedir and replace snprintf

The hugedir returned by get_hugepage_dir is allocated by strdup
 but not released. Replace snprintf with a more suitable strlcpy.

Coverity issue: 272585
Fixes: cb97d93e9d3b ("mem: share hugepage info primary and secondary")

Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
lib/librte_eal/bsdapp/eal/eal_hugepage_info.c
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c
lib/librte_eal/linuxapp/eal/eal_memory.c