On 08/15/2014 04:49 AM, Luiz Capitulino wrote: > On Sun, 03 Aug 2014 23:28:56 +0800 > Chen Gang <gang.chen.5...@gmail.com> wrote: > >> > In dump_init(), when failure occurs, need notice about 'fd' and memory >> > mapping. So call dump_cleanup() for it (need let all initializations at >> > front). >> > >> > Also simplify dump_cleanup(): remove redundant 'ret' and redundant 'fd' >> > checking. >> > >> > Signed-off-by: Chen Gang <gang.chen.5...@gmail.com> > Applied to the qmp branch, thanks. >
Thanks. > PS: I still find it hard to track the file-descriptor's life time. IMO, > the best would be to always release it where it's allocated which is > qmp_dump_guest_memory(). > If it is really hard to track, for me, I prefer to let dump_cleanup() common enough, so can simplify every members thinking. When use genric *_cleanup(), it means the resource manage management is a little complex, need use a generic cleanup function for it to be sure that every thing is not missed, and always save enough. Thanks. -- Chen Gang Open share and attitude like air water and life which God blessed