eal: fix invalid memory read
authorAaron Campbell <aaron@arbor.net>
Thu, 26 Jun 2014 14:54:34 +0000 (10:54 -0400)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Fri, 27 Jun 2014 00:38:05 +0000 (02:38 +0200)
commitb024956a239a199c31b2171095ed505c840df32a
tree3f0c641bf7516afd9e5cb826ab94e9ddb609182b
parent6f41fe75e2dd8dd38f7bea7b9501edd4f9b72fa5
eal: fix invalid memory read

Valgrind reports this issue:

==29880== Invalid read of size 1
==29880==    at 0x56FF9A5: cpu_socket_id (eal_lcore.c:101)
==29880==    by 0x56FFAE9: rte_eal_cpu_init (eal_lcore.c:168)
==29880==    by 0x56F944A: rte_eal_init (eal.c:975)

The problem is that endptr points to memory allocated underneath the DIR
handle, which has already been freed. So move the closedir() call lower.

Signed-off-by: Aaron Campbell <aaron@arbor.net>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
lib/librte_eal/linuxapp/eal/eal_lcore.c