Skip to contentSkip to conversation

zr364xx.c: vfree does its own NULL check

PATCH In review Figo.zhang 1 participant 2 messages Jun 6, 2009 – Jun 15, 2009 Media (V4L/DVB)

lore
Share & tools
lore

Figo.zhang

author
#0 lore raw

PATCH 1/1 zr364xx.c: vfree does its own NULL check

vfree() does it's own NULL checking, no need for explicit check before calling it.

---

 drivers/media/video/zr364xx.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/media/video/zr364xx.c +4 -2
index ac169c9..fc976f4 100644
@@ -882,9 +882,11 @@ static void zr364xx_disconnect(struct usb_interface *intf)
 		video_unregister_device(cam->vdev);
 	cam->vdev = NULL;
 	kfree(cam->buffer);
-	if (cam->framebuf)
-		vfree(cam->framebuf);
+	cam->buffer = NULL;
+	vfree(cam->framebuf);
+	cam->framebuf = NULL;
 	kfree(cam);
+	cam = NULL;
 }
 
 
author
#1 lore raw

hi Mauro,
is it ok for this patch?

Best Regards,

Figo.zhang

Quoted 32 lines · Figo.zhang

vfree() does it's own NULL checking, no need for explicit check before calling it.

---

 drivers/media/video/zr364xx.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/media/video/zr364xx.c +4 -2
index ac169c9..fc976f4 100644
@@ -882,9 +882,11 @@ static void zr364xx_disconnect(struct usb_interface *intf)
 		video_unregister_device(cam->vdev);
 	cam->vdev = NULL;
 	kfree(cam->buffer);
-	if (cam->framebuf)
-		vfree(cam->framebuf);
+	cam->buffer = NULL;
+	vfree(cam->framebuf);
+	cam->framebuf = NULL;
 	kfree(cam);
+	cam = NULL;
 }