Hi All,

>From NetBSD:
Coverity CID 1748: Free alias on error.


                        alias->name = strdup(token->text);
                        if (alias->name == NULL)
                                (void)err(1, "out of memory");
                        
                        token = yylex();
                        if (token == NULL) {
                                free(alias);
                                (void)printf( "EOF in alias definition\n");
                                return;

alias->name calls strdup, but it doesn't free it on if (token == NULL).

Shouldn't it be free'ed as well ?

Index: src/usr.bin/fgen/fgen.l
===================================================================
RCS file: /cvs/src/usr.bin/fgen/fgen.l,v
retrieving revision 1.9
diff -u -p -r1.9 fgen.l
--- src/usr.bin/fgen/fgen.l     10 Dec 2009 17:31:49 -0000      1.9
+++ src/usr.bin/fgen/fgen.l     30 Dec 2013 08:03:10 -0000
@@ -1232,6 +1232,7 @@ tokenize(input) 
                        
                        token = yylex();
                        if (token == NULL) {
+                               free(alias->name);
                                free(alias);
                                (void)printf( "EOF in alias definition\n");
                                return;

Reply via email to