cgroup_get_current_controller_path should test whether strtok_r returns NULL before it continues.
Signed-off-by: Ivana Hutarova Varekova <varek...@redhat.com> --- src/api.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api.c b/src/api.c index 5e39efb..68c523f 100644 --- a/src/api.c +++ b/src/api.c @@ -3299,7 +3299,7 @@ int cgroup_get_current_controller_path(pid_t pid, const char *controller, } token = strtok_r(controllers, ",", &savedptr); - do { + while (token) { if (strncmp(controller, token, strlen(controller) + 1) == 0) { *current_path = strdup(cgroup_path); @@ -3312,7 +3312,7 @@ int cgroup_get_current_controller_path(pid_t pid, const char *controller, goto done; } token = strtok_r(NULL, ",", &savedptr); - } while (token); + } } done: ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel