kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] afs: Fix the memory leak in afs_mkdir
@ 2020-06-23 16:26 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2020-06-23 16:26 UTC (permalink / raw)
  To: Chen Tao, linux-afs; +Cc: linux-kernel, kernel-janitors, David Howells

…
> +++ b/fs/afs/dir.c
> @@ -1599,17 +1599,17 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
>  	scb = kcalloc(2, sizeof(struct afs_status_cb), GFP_KERNEL);
>  	if (!scb)
>  		goto error_scb;

I suggest to adjust also this jump target so that a call of the function “kfree”
with a null pointer can be avoided.


…
> @@ -1645,10 +1645,10 @@  static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
>  error_key:
>  	key_put(key);
> +error_scb:
> +	kfree(scb);
>  error:
>  	d_drop(dentry);
…

Can an other label than “error” be nicer here?

Regards,
Markus

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-23 16:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-23 16:26 [PATCH] afs: Fix the memory leak in afs_mkdir Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).