mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
Fix memory leak when diropen() fails.
Found by: clang static analyzer.
This commit is contained in:
parent
a20e840c97
commit
ffbb4c9f7c
@ -1611,7 +1611,7 @@ static void generate_dir_listing(struct connection *conn, const char *path) {
|
|||||||
ssize_t listsize;
|
ssize_t listsize;
|
||||||
size_t maxlen = 2; /* There has to be ".." */
|
size_t maxlen = 2; /* There has to be ".." */
|
||||||
int i;
|
int i;
|
||||||
struct apbuf *listing = make_apbuf();
|
struct apbuf *listing;
|
||||||
|
|
||||||
listsize = make_sorted_dirlist(path, &list);
|
listsize = make_sorted_dirlist(path, &list);
|
||||||
if (listsize == -1) {
|
if (listsize == -1) {
|
||||||
@ -1626,6 +1626,7 @@ static void generate_dir_listing(struct connection *conn, const char *path) {
|
|||||||
maxlen = tmp;
|
maxlen = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listing = make_apbuf();
|
||||||
append(listing, "<html>\n<head>\n <title>");
|
append(listing, "<html>\n<head>\n <title>");
|
||||||
append(listing, conn->url);
|
append(listing, conn->url);
|
||||||
append(listing, "</title>\n</head>\n<body>\n<h1>");
|
append(listing, "</title>\n</head>\n<body>\n<h1>");
|
||||||
|
Loading…
Reference in New Issue
Block a user