| handlegph: fix memory leak if writing a line failed - geomyidae - A small C-bas… | |
| git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri… | |
| Log | |
| Files | |
| Refs | |
| Tags | |
| README | |
| LICENSE | |
| --- | |
| commit 997f994cfd4318cdd6b9d40f5864b37002976cac | |
| parent 70d5d67d68410c852d9663a6e4935e508897ffdf | |
| Author: Hiltjo Posthuma <[email protected]> | |
| Date: Wed, 8 Mar 2023 20:56:42 +0100 | |
| handlegph: fix memory leak if writing a line failed | |
| Signed-off-by: Christoph Lohmann <[email protected]> | |
| Diffstat: | |
| M handlr.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, c… | |
| 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, po… | |
| + 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); | |
| } | |
| } |