Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:lafenghu
mtdev
U_mtdev_close-should-ignore-NULL-devices.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File U_mtdev_close-should-ignore-NULL-devices.patch of Package mtdev
From 61684cf0466200631b6a44af1c662eb760ad3f5d Mon Sep 17 00:00:00 2001 From: Peter Hutterer <peter.hutterer@who-t.net> Date: Tue, 19 Apr 2011 11:41:04 +0200 Subject: [PATCH 1/2] mtdev_close should ignore NULL devices. Saves us one goto label in mtdev_init. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Henrik Rydberg <rydberg@euromail.se> --- src/core.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core.c b/src/core.c index 1f7c1fe..07bc828 100644 --- a/src/core.c +++ b/src/core.c @@ -365,11 +365,11 @@ int mtdev_open(struct mtdev *dev, int fd) goto error; ret = mtdev_configure(dev, fd); if (ret) - goto mtdev; + goto error; return 0; - mtdev: - mtdev_close(dev); + error: + mtdev_close(dev); return ret; } @@ -411,8 +411,10 @@ void mtdev_close_delete(struct mtdev *dev) void mtdev_close(struct mtdev *dev) { - free(dev->state); - memset(dev, 0, sizeof(struct mtdev)); + if (dev) { + free(dev->state); + memset(dev, 0, sizeof(struct mtdev)); + } } void mtdev_delete(struct mtdev *dev) -- 1.7.6
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor