From d232f318d874e43b983bf99713abe678a5c03b21 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 18 Jul 2021 13:25:09 -0700 Subject: [PATCH] fix memory leak in edgepaint command line parsing When passing the option `-lightness` multiple times, pointers to previous lightness strings would be overwritten and lost. This is unlikely to have had a significant effect. Related to #1971. --- cmd/edgepaint/edgepaintmain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/edgepaint/edgepaintmain.c b/cmd/edgepaint/edgepaintmain.c index 594356cd1..452e1cb2e 100644 --- a/cmd/edgepaint/edgepaintmain.c +++ b/cmd/edgepaint/edgepaintmain.c @@ -164,6 +164,7 @@ static void init(int argc, char *argv[], real *angle, real *accuracy, char **inf fprintf(stderr,"invalid -lightness=%s option.\n", optarg + 9); usage(cmd, 1); } + free(*lightness); *lightness = malloc(sizeof(char)*10); strcpy(*lightness, optarg + 9); } else { -- 2.40.0