[dpdk-dev] [PATCH v8] linuxapp, eal: Fix the memory leak issue of logid
Thomas Monjalon
thomas at monjalon.net
Mon Oct 22 10:00:59 CEST 2018
12/09/2018 03:31, Ziye Yang:
> From: Ziye Yang <optimistyzy at gmail.com>
>
> This patch is used to fix the memory leak issue of logid.
> We use the ASAN test in SPDK when intergrating DPDK and
> find this memory leak issue.
>
> Signed-off-by: Ziye Yang <ziye.yang at intel.com>
> ---
> - logid = strrchr(argv[0], '/');
> - logid = strdup(logid ? logid + 1: argv[0]);
> -
> + p = strrchr(argv[0], '/');
> + snprintf(logid, sizeof(logid), "%s", (p ? p + 1 : argv[0]));
Shouldn't it be strlcpy instead of snprintf?
More information about the dev
mailing list