提交 2355fce3 编写于 作者: J Jim Meyering

node_device_linux_sysfs.c: avoid opendir/fd leak on error path

* src/node_device/node_device_linux_sysfs.c(get_virtual_functions_linux):
Don't leak a DIR buffer and file descriptor on error path.
上级 1825c655
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* node_device_hal_linuc.c: Linux specific code to gather device data * node_device_hal_linuc.c: Linux specific code to gather device data
* not available through HAL. * not available through HAL.
* *
* Copyright (C) 2009 Red Hat, Inc. * Copyright (C) 2009-2010 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -367,10 +367,13 @@ int get_virtual_functions_linux(const char *sysfs_path, ...@@ -367,10 +367,13 @@ int get_virtual_functions_linux(const char *sysfs_path,
} }
closedir(dir); closedir(dir);
dir = NULL;
ret = 0; ret = 0;
out: out:
if (dir)
closedir(dir);
VIR_FREE(device_link); VIR_FREE(device_link);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册