On Thu, Oct 27, 2016 at 01:00:01PM +0530, Souptick Joarder wrote: > On Thu, Oct 27, 2016 at 11:20 AM, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote: > > On Thu, Oct 27, 2016 at 11:10:09AM +0530, Souptick Joarder wrote: > >> There are few functions where we need to free previously allocated memory > >> when kmalloc fails. Else it may lead to memory leakage. > >> In _init_cmd_priv() and _r8712_init_xmit_priv(),in few places we are not > >> freeing previously allocated memory when kmalloc fails. > > > > Odd use of spaces, can you fix that up? > > > >> This patch will address it. > > > > That last sentance is not needed. > > Ok, I will do those changes. > > > > And isn't this a new version of a patch, or am I mistaken? If so, > > please properly version it as SubmittingPatches describes to do. > > This is the new version of previous patch. > > > >> > >> Signed-off-by: Souptick joarder <jrdr.linux@xxxxxxxxx> > >> --- > >> drivers/staging/rtl8712/rtl871x_cmd.c | 5 ++++- > >> drivers/staging/rtl8712/rtl871x_xmit.c | 5 ++++- > >> 2 files changed, 8 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/staging/rtl8712/rtl871x_cmd.c b/drivers/staging/rtl8712/rtl871x_cmd.c > >> index b7ee5e6..04638f1 100644 > >> --- a/drivers/staging/rtl8712/rtl871x_cmd.c > >> +++ b/drivers/staging/rtl8712/rtl871x_cmd.c > >> @@ -72,8 +72,11 @@ static sint _init_cmd_priv(struct cmd_priv *pcmdpriv) > >> ((addr_t)(pcmdpriv->cmd_allocated_buf) & > >> (CMDBUFF_ALIGN_SZ - 1)); > >> pcmdpriv->rsp_allocated_buf = kmalloc(MAX_RSPSZ + 4, GFP_ATOMIC); > >> - if (!pcmdpriv->rsp_allocated_buf) > >> + if (!pcmdpriv->rsp_allocated_buf) { > >> + kfree(pcmdpriv->cmd_allocated_buf); > >> return _FAIL; > >> + } > > > > If you need to set the buffer to NULL, please do so, last time I thought > > you said it was required, is it really not? > > This NULL is required. But I assume, last time you are not agree with it :) > So I remove it in new version. I did not say I disagreed, you just had to prove why you were doing this... thanks, greg k-h _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel