diff options
Diffstat (limited to 'udrv')
-rwxr-xr-x | udrv/ulinux/unv_linux.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/udrv/ulinux/unv_linux.c b/udrv/ulinux/unv_linux.c index 2f58265..75e61c1 100755 --- a/udrv/ulinux/unv_linux.c +++ b/udrv/ulinux/unv_linux.c @@ -657,13 +657,17 @@ int unv_read_key_iter( const char *path, if (fstat(fd, &st) != 0) { error("stat failed (%s)", strerror(errno)); + close(fd); return -1; } p_buf = malloc(st.st_size + 1); if (!p_buf) + { + close(fd); return -1; + } p = p_buf; @@ -671,6 +675,7 @@ int unv_read_key_iter( const char *path, { error("read failed %s", strerror(errno)); free(p_buf); + close(fd); return -1; } |