libaacs | branch: master | npzacs <npz...@gmail.com> | Wed May 6 10:40:40 2015 +0300| [8b9be9563e21c77e9ddcfb72432597cb31a8b1ee] | committer: npzacs
Fix leak > http://git.videolan.org/gitweb.cgi/libaacs.git/?a=commit;h=8b9be9563e21c77e9ddcfb72432597cb31a8b1ee --- src/file/mmc_device_linux.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/file/mmc_device_linux.c b/src/file/mmc_device_linux.c index 3c195cf..c72dce4 100644 --- a/src/file/mmc_device_linux.c +++ b/src/file/mmc_device_linux.c @@ -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) _______________________________________________ libaacs-devel mailing list libaacs-devel@videolan.org https://mailman.videolan.org/listinfo/libaacs-devel