]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Remove warnings created by Clang static analyzer
authorAnders Björklund <anders@psqr.se>
Thu, 3 Nov 2016 20:19:14 +0000 (21:19 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 20 Feb 2017 21:35:33 +0000 (22:35 +0100)
ccache.c:1233:7: warning: Null pointer passed as an argument to a 'nonnull' parameter
ccache.c:1274:7: warning: Null pointer passed as an argument to a 'nonnull' parameter
ccache.c:1291:7: warning: Null pointer passed as an argument to a 'nonnull' parameter
ccache.c:1893:2: warning: Use of memory after it is freed

ccache.c

index b8b50434a3e1cbfc0262a133ed82de56b47d39bd..9fbbdd7d42b4ec135513c81faca7d4ff5a81566a 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -1255,7 +1255,7 @@ to_cache(struct args *args)
                failed();
        }
 
-       if (using_split_dwarf) {
+       if (using_split_dwarf && tmp_dwo) {
                if (stat(tmp_dwo, &st) != 0) {
                        cc_log("Compiler didn't produce a split dwarf file");
                        stats_update(STATS_NOOUTPUT);
@@ -1295,7 +1295,7 @@ to_cache(struct args *args)
                }
        }
 
-       if (generating_coverage) {
+       if (generating_coverage && tmp_cov) {
                // GCC won't generate notes if there is no code.
                if (stat(tmp_cov, &st) != 0 && errno == ENOENT) {
                        FILE *f = fopen(cached_cov, "wb");
@@ -1312,7 +1312,7 @@ to_cache(struct args *args)
                }
        }
 
-       if (generating_stackusage) {
+       if (generating_stackusage && tmp_su) {
                // GCC won't generate notes if there is no code.
                if (stat(tmp_su, &st) != 0 && errno == ENOENT) {
                        FILE *f = fopen(cached_su, "wb");
@@ -1899,6 +1899,7 @@ calculate_object_hash(struct args *args, struct mdfour *hash, int direct_mode)
                                       arch_args[i]);
                                if (i != arch_args_size - 1) {
                                        free(object_hash);
+                                       object_hash = NULL;
                                }
                                args_pop(args, 1);
                        }