Commit 8b9be956 authored by npzacs's avatar npzacs
Browse files

Fix leak

parent 1f1cb7bb
......@@ -115,7 +115,6 @@ MMCDEV *device_open(const char *path)
size_t path_len;
struct stat st;
int fd = -1;
MMCDEV *dev = NULL;
/* resolve path */
if (!aacs_resolve_path(path, resolved_path)) {
......@@ -134,8 +133,6 @@ MMCDEV *device_open(const char *path)
return NULL;
}
dev = calloc(1, sizeof(MMCDEV));
if (S_ISBLK(st.st_mode)) {
/* opening device */
BD_DEBUG(DBG_MMC, "Opening block device %s\n", resolved_path);
......@@ -185,10 +182,14 @@ MMCDEV *device_open(const char *path)
#endif
if (fd >= 0) {
dev = calloc(1, sizeof(MMCDEV));
dev->fd = fd;
MMCDEV *dev = calloc(1, sizeof(MMCDEV));
if (dev) {
dev->fd = fd;
return dev;
}
}
return dev;
return NULL;
}
void device_close(MMCDEV **pp)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment