On Fri, Dec 15, 2006 at 10:38:05AM +0530, Sachin P. Sant wrote:
> Horms wrote:
> >>>I think that memory_range, base_memory_range and exclude_range all
> >>>need to be initialised to NULL here. Otherwise the checks
> >>>in cleanup_memory_ranges() may be bogus.
> >>>
> >
> >Are globals gauranteed to be NULL? I know that in kernel land they are.
> >But I'm not sure about user-space.
> >
> I think so :-).
>
> >>+
> >>+static void cleanup_memory_ranges()
> >>+{
> >>+ if (memory_range)
> >>+ free(memory_range);
> >>+ if (base_memory_range)
> >>+ free(base_memory_range);
> >>+ if (exclude_range)
> >>+ free(exclude_range);
> >>+ if (usablemem_rgns.ranges)
> >>+ free(usablemem_rgns.ranges);
> >>+}
> >>+
> >>+ return 0;
> >>+
> >>+err1:
> >>
> > if (memory_range)
> > free(memory_range);
> > if (base_memory_range)
> > free(base_memory_range);
> > if (exclude_range)
> > free(exclude_range);
> >
> >
> >>+ fprintf(stderr, "memory range structure allocation failure\n");
> >>+ cleanup_memory_ranges();
> >>+ return -1;
> >>+
> >>
> >
> >Sorry to be a pain, but I think that you really need something like the
> >above under err1. Sorry that I didn't notice that yesterday.
> >
> I thought of doing like that as you have mentioned here. But there are
> various
> exit path's in this file depending on the error, where we should
> clean up these memory allocations. Hence i created a seperate function
> cleanup_memory_ranges( ) to do that. That way i don't have to replicate the
> above lines all over the exit paths. In the above case
> also i am calling cleanup_memory_ranges( ), which eventually is the
> same code as you have suggested. Let me kow if that sound ok.
Sorry, I missed that. Yes of course its ok.
I'll applay your patch ASAP.
--
Horms
H: http://www.vergenet.net/~horms/
W: http://www.valinux.co.jp/en/
_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot