geomyidae

A small C-based gopherd. (gopher://bitreich.org/1/scm/geomyidae)
git clone git://r-36.net/geomyidae
Log | Files | Refs | README | LICENSE

commit 997f994cfd4318cdd6b9d40f5864b37002976cac
parent 70d5d67d68410c852d9663a6e4935e508897ffdf
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Wed,  8 Mar 2023 20:56:42 +0100

handlegph: fix memory leak if writing a line failed

Signed-off-by: Christoph Lohmann <20h@r-36.net>

Diffstat:
Mhandlr.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/handlr.c b/handlr.c @@ -108,13 +108,14 @@ handlegph(int sock, char *file, char *port, char *base, char *args, act = scanfile(file); if (act != NULL) { - for (i = 0; i < act->num && ret >= 0; i++) { + for (i = 0; i < act->num && ret >= 0; i++) ret = printelem(sock, act->n[i], file, base, ohost, port); + dprintf(sock, ".\r\n"); + + for (i = 0; i < act->num; i++) { freeelem(act->n[i]); act->n[i] = NULL; } - dprintf(sock, ".\r\n"); - freeindex(act); } }