From d11bee7fc50cf78df61b82ea56e28160b214d3c6 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sun, 28 Aug 2016 09:34:27 +0800 Subject: [PATCH] coverity 169274 - lwsgt dirlisting ignore files that cant be statted --- plugins/generic-table/protocol_table_dirlisting.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/generic-table/protocol_table_dirlisting.c b/plugins/generic-table/protocol_table_dirlisting.c index 39ab79c..c4359b6 100644 --- a/plugins/generic-table/protocol_table_dirlisting.c +++ b/plugins/generic-table/protocol_table_dirlisting.c @@ -123,7 +123,7 @@ scan_dir(struct lws *wsi, struct per_session_data__tbl_dir *pss) if (stat(path, &st)) { lwsl_info("unable to stat %s\n", path); - goto bail; + continue; } f = malloc(sizeof(*f)); f->next = NULL; @@ -142,8 +142,10 @@ scan_dir(struct lws *wsi, struct per_session_data__tbl_dir *pss) if (f->uri) pss->p += n + 1; - if (end - pss->p < 100) + if (end - pss->p < 100) { + free(f); break; + } icon = " "; if ((S_IFMT & st.st_mode) == S_IFDIR) @@ -165,7 +167,6 @@ scan_dir(struct lws *wsi, struct per_session_data__tbl_dir *pss) prev = f; } -bail: uv_fs_req_cleanup(&req); return ret; -- 2.7.4