On Thu, 2015-05-07 at 15:32 +0200, Cyril Hrubis wrote:
> Hi!
> > It will encounter resource leak for fp as the old flow,
> > while fopen succeeds and the pointer para is NULL.
> > This patch aims to avoid this resource leak.
> > 
> > Signed-off-by: Wei,Jiangang <weijg.f...@cn.fujitsu.com>
> > ---
> >  testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.c 
> > b/testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.c
> > index 1c33d0c..c845cf8 100644
> > --- a/testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.c
> > +++ b/testcases/kernel/sched/hyperthreading/ht_interrupt/ht_utils.c
> > @@ -30,8 +30,8 @@ int is_cmdline_para(const char *para)
> 
> Looking a the code it would be way easier to change it to:
> 
>       if (!para)
>               return 0;
> 
> Then we will need to close the file only inside of the if condition:
> 
>       if ((fp = fopen("/proc/cmdline", "r")) != NULL)) {
>               ...
>               fclose(fp);
>       }
> 
> >                             return 1;
> >                     }
> >             }
> > -           fclose(fp);
> >     }
> > +   if (fp != NULL) fclose(fp);
> 
> This code is not following LKML coding style. You can use checkpath.pl
> (distributed with Linux kernel sources) to check you patches before
> submission.
Thanks for your kind.
I will check every patch by it from now on.

Wei.
> 

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to