]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
misc: fix header complaints and resource leaks in e2fsprogs
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 14 Mar 2014 13:43:11 +0000 (09:43 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 14 Mar 2014 13:53:19 +0000 (09:53 -0400)
Fix a few minor bugs that cppcheck complained about.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
debugfs/debugfs.c
debugfs/util.c
lib/ext2fs/icount.c
util/subst.c

index a10446d038517a2b9ce587f2fd231ef4edf42a78..72ab04060ccfffe7e7f2e322cf9a6997bb8643e9 100644 (file)
@@ -657,6 +657,7 @@ static void dump_extents(FILE *f, const char *prefix, ext2_ino_t ino,
        }
        if (printed)
                fprintf(f, "\n");
+       ext2fs_extent_free(handle);
 }
 
 static void dump_inline_data(FILE *out, const char *prefix, ext2_ino_t inode_num)
index 9ddfe0ba089a989d3c8980e2b938b007a13f641d..5cc4e22b58af16b13c398248f68d33e9c7e45664 100644 (file)
@@ -201,7 +201,7 @@ char *time_to_string(__u32 cl)
                tz = ss_safe_getenv("TZ");
                if (!tz)
                        tz = "";
-               do_gmt = !strcmp(tz, "GMT") | !strcmp(tz, "GMT0");
+               do_gmt = !strcmp(tz, "GMT") || !strcmp(tz, "GMT0");
        }
 
        return asctime((do_gmt) ? gmtime(&t) : localtime(&t));
index a3b20f0658b0d609db8442bb5e0641b00a60733c..5e1f5c65479101eb2d7c9d670e19d9a1aa133222 100644 (file)
@@ -193,13 +193,14 @@ errcode_t ext2fs_create_icount_tdb(ext2_filsys fs, char *tdb_dir,
                goto errout;
        uuid_unparse(fs->super->s_uuid, uuid);
        sprintf(fn, "%s/%s-icount-XXXXXX", tdb_dir, uuid);
-       icount->tdb_fn = fn;
        save_umask = umask(077);
        fd = mkstemp(fn);
        if (fd < 0) {
                retval = errno;
+               ext2fs_free_mem(&fn);
                goto errout;
        }
+       icount->tdb_fn = fn;
        umask(save_umask);
        /*
         * This is an overestimate of the size that we will need; the
index 2ea16d9ba3ca374d6a44923158b73f983f9601ee..32d5293207c77c4aca74ba5a628fcebcaf2614a7 100644 (file)
@@ -17,6 +17,9 @@
 #include <fcntl.h>
 #include <time.h>
 #include <utime.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
 
 #ifdef HAVE_GETOPT_H
 #include <getopt.h>