Coverity: CID 610-DEAD CODE 611-UNUSED VALUE
authorNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 24 Feb 2012 21:10:44 +0000 (16:10 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Fri, 24 Feb 2012 21:10:44 +0000 (16:10 -0500)
* lib-src/etags.c (process_file_name): compr was not being used
before anyway so just remove the assignment from the if statement.

* lib-src/etags.c (process_file_name): only make compressed_value
NULL if it was previously not null. But still free it. This means
that after the free we CANNOT dereference it.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
lib-src/etags.c

index 62e8959..8fcc2e9 100644 (file)
@@ -1531,7 +1531,7 @@ language *lang;
                error ("skipping inclusion of %s in self.", file);
                return;
        }
-       if ((compr = get_compressor_from_suffix (file, &ext)) == NULL)
+       if ( get_compressor_from_suffix (file, &ext) == NULL)
        {
                real_name = uncompressed_name = savestr (file);
        }
@@ -1578,14 +1578,14 @@ language *lang;
                if ( inf == NULL ) {
                        /* Reset real_name and try with a different name. */
                        free(compressed_name);
-                       compressed_name = NULL;
                        real_name = NULL;
                        if (compressed_name != NULL) 
                                 /* try with the given suffix */
                        {
+                               compressed_name = NULL;
                                real_name = uncompressed_name;
                        }
-                       else if ( compr->suffix != NULL ) 
+                       else if ( compr && compr->suffix != NULL ) 
                                 /* try all possible suffixes */
                        {
                                compressed_name = concat (file, ".", compr->suffix);