commit - b07649844986a31ed1720dab9b3717b7fe315b9f
commit + f530ab0e9647e91457d9f44afe8be17788bf1e8a
blob - 94c7c9cf35b2a72b7e964ac7bb590c20b6e9b143
blob + 4c5aa4b12300ce3bda67e69e0c3b68a77e29e5aa
--- gotwebd/gotweb.c
+++ gotwebd/gotweb.c
struct querystring *qs = t->qs;
struct repo_dir *repo_dir = NULL;
DIR *d;
- struct dirent **sd_dent;
+ struct dirent **sd_dent = NULL;
const char *index_page_str;
char *c_path = NULL;
struct stat st;
d_cnt = scandir(srv->repos_path, &sd_dent, NULL, alphasort);
if (d_cnt == -1) {
+ sd_dent = NULL;
error = got_error_from_errno2("scandir", srv->repos_path);
goto done;
}
if (error)
goto done;
done:
+ if (sd_dent) {
+ for (d_i = 0; d_i < d_cnt; d_i++)
+ free(sd_dent[d_i]);
+ free(sd_dent);
+ }
if (d != NULL && closedir(d) == EOF && error == NULL)
error = got_error_from_errno("closedir");
return error;