From 77529668653fd8e2ce2c2d2fe1ef2cba0989e316 Mon Sep 17 00:00:00 2001 From: Jon Trulson Date: Sat, 31 Mar 2018 18:21:14 -0600 Subject: [PATCH] dthelp/helpgen.c: coverity CID 175085; use after free --- cde/programs/dthelp/dthelpgen/helpgen.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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; } -- 2.25.1