Staging: iio: Documentation: Fix resource leak in function dump_channels
Subsystems (3)
PATCH 1/1 Staging: iio: Documentation: Fix resource leak in function dump_channels
This patch fixes the following error reported by cppcheck tool:
[drivers/staging/iio/Documentation/lsiio.c:59]: (error) Resource leak: dp
The closedir function closes the file descriptor dp which was previously opened by calling opendir and eliminated the cppcheck error.
--- drivers/staging/iio/Documentation/lsiio.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/iio/Documentation/lsiio.c +1 -0
@@ -55,6 +55,7 @@ static int dump_channels(const char *dev_dir_name) check_postfix(ent->d_name, "_raw")) {printf (" %-10s\n" , ent->d_name); } +closedir (dp);return 0 ; }
Signature · 1 line
1.9.1
Quoted 6 lines · Darshana Padmadas
This patch fixes the following error reported by cppcheck tool:
[drivers/staging/iio/Documentation/lsiio.c:59]: (error) Resource leak: dpThe closedir function closes the file descriptor dp which was previously opened by calling opendir and eliminated the cppcheck error.
This is a nice fix!
lsiio was recently moved from staging to tools/iio. I think it's better to rebase your patch on top of Jonathan's iio tree [1] (togreg branch).
.. and have this patch merged via linux-iio.
Daniel.
[1] https://git.kernel.org/cgit/linux/kernel/git/jic23/iio.git/