summaryrefslogtreecommitdiff
path: root/libthor
diff options
context:
space:
mode:
authorDongwoo Lee <dwoo08.lee@samsung.com>2018-05-09 15:21:34 +0900
committerSeung-Woo Kim <sw0312.kim@samsung.com>2018-05-18 12:30:28 +0900
commit1ec0490922ecb0a824a8c705f7f0091f7eefb46d (patch)
tree4d26fc9988dfbcf16de0cb04a922d7aaae4080bb /libthor
parentaac8a6fee15d059345666d4c1f2f02188632cab6 (diff)
downloadlthor-1ec0490922ecb0a824a8c705f7f0091f7eefb46d.tar.gz
lthor-1ec0490922ecb0a824a8c705f7f0091f7eefb46d.tar.bz2
lthor-1ec0490922ecb0a824a8c705f7f0091f7eefb46d.zip
Fix wrong close for negative file descriptor
There is an issue which negative file descriptor can be attempt to close in static analysis tool result. This patch fixes to skip close on that case. Change-Id: Ic68803bc96ab6e3737d1bcc4779b8e3c58c7ef71 Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Diffstat (limited to 'libthor')
-rw-r--r--libthor/thor_raw_file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libthor/thor_raw_file.c b/libthor/thor_raw_file.c
index e357c68..fa02f28 100644
--- a/libthor/thor_raw_file.c
+++ b/libthor/thor_raw_file.c
@@ -100,7 +100,7 @@ int t_file_get_data_src(const char *path, struct thor_data_src **data)
ret = open(path, O_RDONLY);
if (ret < 0)
- goto close_file;
+ goto free_data;
fdata->fd = ret;
@@ -138,6 +138,7 @@ int t_file_get_data_src(const char *path, struct thor_data_src **data)
close_file:
close(ret);
+free_data:
free(fdata);
return -EINVAL;
}