Quoting Dwight Engen (dwight.en...@oracle.com):
> Don't worry about saved_errno since none of the *_free routines will set it
> 
> Signed-off-by: Dwight Engen <dwight.en...@oracle.com>

Acked-by: Serge E. Hallyn <serge.hal...@ubuntu.com>

Thanks, sorry for taking so long.  I'll rebase this on top of my
split-up-meta2 patch and apply

> ---
>  src/lxc/cgroup.c | 18 ++++++++++--------
>  1 file changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c
> index 101998b..bf7a2a2 100644
> --- a/src/lxc/cgroup.c
> +++ b/src/lxc/cgroup.c
> @@ -293,7 +293,7 @@ struct cgroup_meta_data *lxc_cgroup_load_meta2(const char 
> **subsystem_whitelist)
>       }
>  
>       while (getline(&line, &sz, proc_self_mountinfo) != -1) {
> -             char *token, *saveptr = NULL;
> +             char *token, *line_tok, *saveptr = NULL;
>               size_t i, j, k;
>               struct cgroup_mount_point *mount_point;
>               struct cgroup_hierarchy *h;
> @@ -302,7 +302,7 @@ struct cgroup_meta_data *lxc_cgroup_load_meta2(const char 
> **subsystem_whitelist)
>               if (line[0] && line[strlen(line) - 1] == '\n')
>                       line[strlen(line) - 1] = '\0';
>  
> -             for (i = 0; (token = strtok_r(line, " ", &saveptr)); line = 
> NULL) {
> +             for (i = 0, line_tok = line; (token = strtok_r(line_tok, " ", 
> &saveptr)); line_tok = NULL) {
>                       r = lxc_grow_array((void ***)&tokens, &token_capacity, 
> i + 1, 64);
>                       if (r < 0)
>                               goto out4;
> @@ -441,6 +441,7 @@ struct cgroup_meta_data *lxc_cgroup_put_meta(struct 
> cgroup_meta_data *meta_data)
>                       lxc_cgroup_hierarchy_free(meta_data->hierarchies[i]);
>       }
>       free(meta_data->hierarchies);
> +     free(meta_data);
>       return NULL;
>  }
>  
> @@ -1067,29 +1068,30 @@ char *lxc_cgroup_get_hierarchy_abs_path(const char 
> *subsystem, const char *name,
>       struct cgroup_process_info *base_info, *info;
>       struct cgroup_mount_point *mp;
>       char *result = NULL;
> -     int saved_errno;
>  
>       meta = lxc_cgroup_load_meta();
>       if (!meta)
>               return NULL;
>       base_info = lxc_cgroup_get_container_info(name, lxcpath, meta);
>       if (!base_info)
> -             return NULL;
> +             goto out1;
>       info = find_info_for_subsystem(base_info, subsystem);
>       if (!info)
> -             return NULL;
> +             goto out2;
>       if (info->designated_mount_point) {
>               mp = info->designated_mount_point; 
>       } else {
>               mp = lxc_cgroup_find_mount_point(info->hierarchy, 
> info->cgroup_path, true);
>               if (!mp)
> -                     return NULL;
> +                     goto out3;
>       }
>       result = cgroup_to_absolute_path(mp, info->cgroup_path, NULL);
> -     saved_errno = errno;
> +out3:
> +     lxc_cgroup_process_info_free(info);
> +out2:
>       lxc_cgroup_process_info_free(base_info);
> +out1:
>       lxc_cgroup_put_meta(meta);
> -     errno = saved_errno;
>       return result;
>  }
>  
> -- 
> 1.8.1.4
> 
> 
> ------------------------------------------------------------------------------
> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
> http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel

------------------------------------------------------------------------------
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=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to