Fix a typo when the '/' character is tested on the last but one position instead of the last. There have to be more allocated more memory in the same function.
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 f78704a..d5d0ce7 100644 --- a/src/api.c +++ b/src/api.c @@ -2707,10 +2707,10 @@ char *cgroup_copy_with_slash(char *input) int len = strlen(input); /* if input does not end with '/', allocate one more space for it */ - if ((input[len-2]) != '/') + if ((input[len-1]) != '/') len = len+1; - output = (char *)malloc(sizeof(char)*(len)); + output = (char *)malloc(sizeof(char)*(len+1)); if (output == NULL) return NULL; ------------------------------------------------------------------------------ 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