From: Jon Trulson Date: Sun, 1 Apr 2018 00:21:14 +0000 (-0600) Subject: dthelp/helpgen.c: coverity CID 175085; use after free X-Git-Tag: 2.2.4a~157 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=77529668653fd8e2ce2c2d2fe1ef2cba0989e316;p=oweals%2Fcde.git dthelp/helpgen.c: coverity CID 175085; use after free --- diff --git a/cde/programs/dthelp/dthelpgen/helpgen.c b/cde/programs/dthelp/dthelpgen/helpgen.c index 69f26864..1ce60bc3 100644 --- a/cde/programs/dthelp/dthelpgen/helpgen.c +++ b/cde/programs/dthelp/dthelpgen/helpgen.c @@ -384,7 +384,7 @@ CreateFamily ( char *title = NULL; char *abstract = NULL; char *list = NULL; - char *token; + char *token = NULL; char *ptr; char *bitmap = NULL; char familyName [20]; /* FAMILY%d */ @@ -501,8 +501,11 @@ CreateFamily ( CreateVolumeLink (canvas,out_topic, token) == 0) count++; - if (token && *token != '\0' && *token != '\n') + if (token) + { free ((void *) token); + token = NULL; + } } while (list && *list != '\0'); @@ -579,8 +582,7 @@ CreateFamily ( } XrmDestroyDatabase (db); } - - free (token); + return result; }