mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
. Patch up a leak by freeing target when needed.
This commit is contained in:
parent
832851b83d
commit
850543f7d6
@ -1477,6 +1477,7 @@ static void process_get(struct connection *conn)
|
||||
default_reply(conn, 500, "Internal Server Error",
|
||||
"stat(%s) failed: %s.", conn->uri, strerror(errno));
|
||||
|
||||
safefree(target);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1484,11 +1485,13 @@ static void process_get(struct connection *conn)
|
||||
if (S_ISDIR(filestat.st_mode))
|
||||
{
|
||||
redirect(conn, "%s/", conn->uri);
|
||||
safefree(target);
|
||||
return;
|
||||
}
|
||||
else if (!S_ISREG(filestat.st_mode))
|
||||
{
|
||||
default_reply(conn, 403, "Forbidden", "Not a regular file.");
|
||||
safefree(target);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user