gfs2-utils: master - fsck.gfs2: Plug a leak in peruse_system_dinode()
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 968f58cbdf01f6e8f3b7f3024556b5d7d5237b88
Parent: 6f8a9a9e4ccc96a3383ea8de181b9224e0907802
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Fri Jan 20 11:07:45 2012 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Fri Jan 20 11:07:45 2012 +0000
fsck.gfs2: Plug a leak in peruse_system_dinode()
Spotted by coverity: Variable "ip" going out of scope leaks the storage
it points to.
If one of the if/else conditions is true, ip is stored in a global
variable or freed, so the leak happens when none of them are true. To
fix this I've added an else statement to free ip and moved the
out_discard_ip label into it to avoid duplicating the inode_put().
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/initialize.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index 3daf12d..f07e0b2 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -911,11 +911,10 @@ static void peruse_system_dinode(struct gfs2_sbd *sdp, struct gfs2_dinode *di,
fix_md.qinode = ip;
log_warn(_("Found system quota file at: 0x%llx\n"),
di->di_num.no_addr);
- }
- return;
-
+ } else {
out_discard_ip:
- inode_put(&ip);
+ inode_put(&ip);
+ }
}
/**
12 years, 5 months
gfs2-utils: master - libgfscontrol: Fix resource leaks
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 6f8a9a9e4ccc96a3383ea8de181b9224e0907802
Parent: fcd13421538f30299d1406a7d498001d6ea198ba
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Fri Jan 20 10:33:41 2012 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Fri Jan 20 10:33:41 2012 +0000
libgfscontrol: Fix resource leaks
Spotted by coverity:
- Variable "reply" going out of scope leaks the storage it points to (3
occurrences) and
- Handle variable "fd" going out of scope leaks the handle.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
group/libgfscontrol/main.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/group/libgfscontrol/main.c b/group/libgfscontrol/main.c
index c6eaf97..96a8e03 100644
--- a/group/libgfscontrol/main.c
+++ b/group/libgfscontrol/main.c
@@ -108,7 +108,7 @@ static int do_dump(int cmd, char *name, char *buf)
fd = do_connect(GFSC_QUERY_SOCK_PATH);
if (fd < 0) {
rv = fd;
- goto out;
+ goto out_free;
}
rv = do_write(fd, &h, sizeof(h));
@@ -127,6 +127,8 @@ static int do_dump(int cmd, char *name, char *buf)
GFSC_DUMP_SIZE);
out_close:
close(fd);
+ out_free:
+ free(reply);
out:
return rv;
}
@@ -238,7 +240,7 @@ int gfsc_mountgroups(int max, int *count, struct gfsc_mountgroup *mgs)
fd = do_connect(GFSC_QUERY_SOCK_PATH);
if (fd < 0) {
rv = fd;
- goto out;
+ goto out_free;
}
rv = do_write(fd, &h, sizeof(h));
@@ -268,6 +270,8 @@ int gfsc_mountgroups(int max, int *count, struct gfsc_mountgroup *mgs)
mg_count * sizeof(struct gfsc_mountgroup));
out_close:
close(fd);
+ out_free:
+ free(reply);
out:
return rv;
}
@@ -296,7 +300,7 @@ int gfsc_mountgroup_nodes(char *name, int type, int max, int *count,
fd = do_connect(GFSC_QUERY_SOCK_PATH);
if (fd < 0) {
rv = fd;
- goto out;
+ goto out_free;
}
rv = do_write(fd, &h, sizeof(h));
@@ -326,6 +330,8 @@ int gfsc_mountgroup_nodes(char *name, int type, int max, int *count,
node_count * sizeof(struct gfsc_node));
out_close:
close(fd);
+ out_free:
+ free(reply);
out:
return rv;
}
@@ -409,7 +415,7 @@ int gfsc_fs_leave(struct gfsc_mount_args *ma, int reason)
char msg[sizeof(struct gfsc_header) + sizeof(struct gfsc_mount_args)];
struct gfsc_header *h = (struct gfsc_header *)msg;
char *name = strstr(ma->table, ":") + 1;
- int fd;
+ int fd, err;
init_header(h, GFSC_CMD_FS_LEAVE, name,
sizeof(struct gfsc_mount_args));
@@ -423,6 +429,8 @@ int gfsc_fs_leave(struct gfsc_mount_args *ma, int reason)
if (fd < 0)
return fd;
- return do_write(fd, msg, sizeof(msg));
+ err = do_write(fd, msg, sizeof(msg));
+ close(fd);
+ return err;
}
12 years, 5 months
cluster: RHEL6 - mkfs.gfs2: Improve error messages
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 5cc5be69a593db11dce8745247f82d6b582d5313
Parent: 3b33ff879bb10d5086cf4a62f53b4bd8a37ca571
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Jan 18 16:30:12 2012 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Jan 18 17:46:54 2012 +0000
mkfs.gfs2: Improve error messages
Currently mkfs.gfs2 does not warn that the lock table has been omitted,
it just complains about a missing colon in the lock table. It also
prefixes error messages with the absolute path of the source file. This
patch removes the path from error messages (in mkfs and edit) and adds a
check for an empty lock table.
rhbz#769400
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/libgfs2.h | 1 -
gfs2/mkfs/main_mkfs.c | 4 ++++
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 9e97267..9063c8b 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -77,7 +77,6 @@ static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
void die(const char *fmt, ...)
{
va_list ap;
- fprintf(stderr, "%s: ", __FILE__);
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 1bdfd55..3db3b14 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -258,6 +258,10 @@ static void test_locking(char *lockproto, char *locktable)
/* Nolock is always ok. */
} else if (strcmp(lockproto, "lock_gulm") == 0 ||
strcmp(lockproto, "lock_dlm") == 0) {
+ if (locktable == NULL || *locktable == '\0') {
+ fprintf(stderr, _("No lock table specified.\n"));
+ exit(-1);
+ }
for (c = locktable; *c; c++) {
if (isspace(*c))
die( _("locktable error: contains space characters\n"));
12 years, 5 months
cluster: RHEL57 - fence_rhevm: REST API URL needs to be updated to /api
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 32f36689f34d1790ed44a077bd137269ee5a653e
Parent: a95c78f44a9b819eab37f541fde9f5784dd9f9c5
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Aug 29 10:47:36 2011 +0200
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Wed Jan 18 12:40:42 2012 -0500
fence_rhevm: REST API URL needs to be updated to /api
Resolves: rhbz#782833
---
fence/agents/rhevm/fence_rhevm.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index c9625a2..e420455 100755
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -88,7 +88,7 @@ def send_command(opt, command, method = "GET"):
else:
url = "http:"
- url += "//" + opt["-a"] + ":" + str(opt["-u"]) + "/rhevm-api/" + command
+ url += "//" + opt["-a"] + ":" + str(opt["-u"]) + "/api/" + command
## send command through pycurl
c = pycurl.Curl()
12 years, 5 months
cluster: RHEL57 - fence_rhevm: change "UP" status to "up" state as the REST-API has changed
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: a95c78f44a9b819eab37f541fde9f5784dd9f9c5
Parent: 7cb765d530c34dc39cb0e6ed36641f3feafd4c6d
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Mon Aug 22 10:02:25 2011 +0200
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Wed Jan 18 12:40:07 2012 -0500
fence_rhevm: change "UP" status to "up" state as the REST-API has changed
Resolves: rhbz#782833
---
fence/agents/rhevm/fence_rhevm.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/agents/rhevm/fence_rhevm.py b/fence/agents/rhevm/fence_rhevm.py
index 1cb8d00..c9625a2 100755
--- a/fence/agents/rhevm/fence_rhevm.py
+++ b/fence/agents/rhevm/fence_rhevm.py
@@ -12,7 +12,7 @@ BUILD_DATE=""
#END_VERSION_GENERATION
re_get_id = re.compile("<vm id=\"(.*?)\"", re.IGNORECASE);
-re_status = re.compile("<status>(.*?)</status>", re.IGNORECASE);
+re_status = re.compile("<state>(.*?)</state>", re.IGNORECASE);
re_get_name = re.compile("<name>(.*?)</name>", re.IGNORECASE);
def get_power_status(conn, options):
@@ -40,7 +40,7 @@ def get_power_status(conn, options):
else:
status = result.group(1)
- if (status == "UP"):
+ if (status == "up"):
return "on"
else:
return "off"
12 years, 5 months
gfs2-utils: master - mkfs.gfs2: Improve error messages
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: fcd13421538f30299d1406a7d498001d6ea198ba
Parent: e8a03a6c8758c98dfe56e2cd4d46a5e4bcb013ab
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Jan 18 16:30:12 2012 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Jan 18 16:34:03 2012 +0000
mkfs.gfs2: Improve error messages
Currently mkfs.gfs2 does not warn that the lock table has been omitted,
it just complains about a missing colon in the lock table. It also
prefixes error messages with the absolute path of the source file. This
patch removes the path from error messages (in mkfs and edit) and adds a
check for an empty lock table.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/hexedit.h | 1 -
gfs2/mkfs/gfs2_mkfs.h | 1 -
gfs2/mkfs/main_mkfs.c | 4 ++++
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
index b05b5c0..dd76810 100644
--- a/gfs2/edit/hexedit.h
+++ b/gfs2/edit/hexedit.h
@@ -129,7 +129,6 @@ static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
void die(const char *fmt, ...)
{
va_list ap;
- fprintf(stderr, "%s: ", __FILE__);
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
diff --git a/gfs2/mkfs/gfs2_mkfs.h b/gfs2/mkfs/gfs2_mkfs.h
index d7d7da7..231f370 100644
--- a/gfs2/mkfs/gfs2_mkfs.h
+++ b/gfs2/mkfs/gfs2_mkfs.h
@@ -24,7 +24,6 @@ static __inline__ __attribute__((noreturn, format (printf, 1, 2)))
void die(const char *fmt, ...)
{
va_list ap;
- fprintf(stderr, "%s: ", __FILE__);
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 3658fd4..7c93621 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -257,6 +257,10 @@ static void test_locking(char *lockproto, char *locktable)
/* Nolock is always ok. */
} else if (strcmp(lockproto, "lock_gulm") == 0 ||
strcmp(lockproto, "lock_dlm") == 0) {
+ if (locktable == NULL || *locktable == '\0') {
+ fprintf(stderr, _("No lock table specified.\n"));
+ exit(-1);
+ }
for (c = locktable; *c; c++) {
if (isspace(*c))
die( _("locktable error: contains space characters\n"));
12 years, 5 months
gfs2-utils: master - fsck.gfs2: Remove unused hash.c, hash.h
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: e8a03a6c8758c98dfe56e2cd4d46a5e4bcb013ab
Parent: f29c6083c5e71eec2165bc1b3c41293b73d6c467
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Wed Jan 18 10:17:08 2012 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Jan 18 10:17:08 2012 +0000
fsck.gfs2: Remove unused hash.c, hash.h
The functions in hash.c aren't being used so it can be removed.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/Makefile.am | 4 +-
gfs2/fsck/hash.c | 93 ------------------------------------------------
gfs2/fsck/hash.h | 7 ----
gfs2/fsck/inode_hash.c | 1 -
gfs2/fsck/metawalk.c | 1 -
5 files changed, 2 insertions(+), 104 deletions(-)
diff --git a/gfs2/fsck/Makefile.am b/gfs2/fsck/Makefile.am
index e6a621f..261f6b1 100644
--- a/gfs2/fsck/Makefile.am
+++ b/gfs2/fsck/Makefile.am
@@ -10,10 +10,10 @@ sbindir := $(shell rpl=0; test '$(exec_prefix):$(sbindir)' = /usr:/usr/sbin \
sbin_PROGRAMS = fsck.gfs2
-noinst_HEADERS = eattr.h fs_bits.h fsck.h fs_recovery.h hash.h \
+noinst_HEADERS = eattr.h fs_bits.h fsck.h fs_recovery.h \
inode_hash.h link.h lost_n_found.h metawalk.h util.h
-fsck_gfs2_SOURCES = eattr.c fs_recovery.c hash.c initialize.c \
+fsck_gfs2_SOURCES = eattr.c fs_recovery.c initialize.c \
inode_hash.c link.c lost_n_found.c main.c metawalk.c \
pass1b.c pass1.c pass1c.c pass2.c pass3.c pass4.c \
pass5.c rgrepair.c util.c
diff --git a/gfs2/fsck/hash.c b/gfs2/fsck/hash.c
deleted file mode 100644
index f55c2a7..0000000
--- a/gfs2/fsck/hash.c
+++ /dev/null
@@ -1,93 +0,0 @@
-#include "clusterautoconfig.h"
-
-/* This is the same hash algorithm used by the glocks in gfs */
-
-#include <stdint.h>
-#include <unistd.h>
-#include "libgfs2.h"
-#include "hash.h"
-#include "osi_list.h"
-
-/**
- * hash_more_internal - hash an array of data
- * @data: the data to be hashed
- * @len: the length of data to be hashed
- * @hash: the hash from a previous call
- *
- * Take some data and convert it to a 32-bit hash.
- *
- * This is the 32-bit FNV-1a hash from:
- * http://www.isthe.com/chongo/tech/comp/fnv/
- *
- * Hash guts
- *
- * Returns: the hash
- */
-
-static __inline__ uint32_t
-hash_more_internal(const void *data, unsigned int len, uint32_t hash)
-{
- unsigned char *p = (unsigned char *) data;
- unsigned char *e = p + len;
- uint32_t h = hash;
-
- while (p < e) {
- h ^= (uint32_t) (*p++);
- h *= 0x01000193;
- }
-
- return h;
-}
-
-/**
- * fsck_hash - hash an array of data
- * @data: the data to be hashed
- * @len: the length of data to be hashed
- *
- * Take some data and convert it to a 32-bit hash.
- *
- * This is the 32-bit FNV-1a hash from:
- * http://www.isthe.com/chongo/tech/comp/fnv/
- *
- * Returns: the hash
- */
-
-uint32_t
-fsck_hash(const void *data, unsigned int len)
-{
- uint32_t h = 0x811C9DC5;
- h = hash_more_internal(data, len, h);
- return h;
-}
-
-/**
- * fsck_hash_more - hash an array of data
- * @data: the data to be hashed
- * @len: the length of data to be hashed
- * @hash: the hash from a previous call
- *
- * Take some data and convert it to a 32-bit hash.
- *
- * This is the 32-bit FNV-1a hash from:
- * http://www.isthe.com/chongo/tech/comp/fnv/
- *
- * This version let's you hash together discontinuous regions.
- * For example, to compute the combined hash of the memory in
- * (data1, len1), (data2, len2), and (data3, len3) you:
- *
- * h = fsck_hash(data1, len1);
- * h = fsck_hash_more(data2, len2, h);
- * h = fsck_hash_more(data3, len3, h);
- *
- * Returns: the hash
- */
-
-uint32_t
-fsck_hash_more(const void *data, unsigned int len, uint32_t hash)
-{
- uint32_t h;
- h = hash_more_internal(data, len, hash);
- return h;
-}
-
-
diff --git a/gfs2/fsck/hash.h b/gfs2/fsck/hash.h
deleted file mode 100644
index d5fe8e9..0000000
--- a/gfs2/fsck/hash.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _HASH_H
-#define _HASH_H
-
-uint32_t fsck_hash(const void *data, unsigned int len);
-uint32_t fsck_hash_more(const void *data, unsigned int len, uint32_t hash);
-
-#endif /* _HASH_H */
diff --git a/gfs2/fsck/inode_hash.c b/gfs2/fsck/inode_hash.c
index 731c9c6..e2d3c29 100644
--- a/gfs2/fsck/inode_hash.c
+++ b/gfs2/fsck/inode_hash.c
@@ -7,7 +7,6 @@
#include "libgfs2.h"
#include "osi_list.h"
-#include "hash.h"
#include "inode_hash.h"
#include "fsck.h"
#define _(String) gettext(String)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index eb80ccf..fc87d2f 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -16,7 +16,6 @@
#include "fsck.h"
#include "util.h"
#include "metawalk.h"
-#include "hash.h"
#include "inode_hash.h"
#define COMFORTABLE_BLKS 5242880 /* 20GB in 4K blocks */
12 years, 5 months
gfs2-utils: master - fsck.gfs2: Plug a leak in find_block_ref()
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: f29c6083c5e71eec2165bc1b3c41293b73d6c467
Parent: d0a0e58a4de53a0c582acc1d6a9333e7502f0168
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Fri Jan 13 12:12:47 2012 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Fri Jan 13 12:12:47 2012 +0000
fsck.gfs2: Plug a leak in find_block_ref()
Spotted by coverity: Variable "ip" going out of scope leaks the storage
it points to.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/pass1b.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index ae6d45c..9e6f376 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -344,6 +344,7 @@ static int find_block_ref(struct gfs2_sbd *sdp, uint64_t inode)
log_debug( _("Block %lld (0x%llx) is not gfs2 metadata.\n"),
(unsigned long long)inode,
(unsigned long long)inode);
+ fsck_inode_put(&ip);
return 1;
}
/* Check to see if this inode was referenced by another by mistake */
12 years, 5 months
gfs2-utils: master - fsck.gfs2: Fix null pointer deref in check_system_dir()
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: d0a0e58a4de53a0c582acc1d6a9333e7502f0168
Parent: 5eb51a7d94b89a53427fff36ba041caf92d35508
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Fri Jan 13 11:41:02 2012 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Fri Jan 13 11:41:02 2012 +0000
fsck.gfs2: Fix null pointer deref in check_system_dir()
Spotted by coverity: Dereferencing null variable "sysinode".
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/pass2.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index c530695..78c9f47 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -623,10 +623,15 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
log_info( _("Checking system directory inode '%s'\n"), dirname);
- if (sysinode) {
- iblock = sysinode->i_di.di_num.no_addr;
- ds.q = block_type(iblock);
+ if (!sysinode) {
+ log_err( _("Failed to check '%s': sysinode is null\n"), dirname);
+ stack;
+ return -1;
}
+
+ iblock = sysinode->i_di.di_num.no_addr;
+ ds.q = block_type(iblock);
+
pass2_fxns.private = (void *) &ds;
if (ds.q == gfs2_bad_block) {
/* First check that the directory's metatree is valid */
12 years, 5 months
gfs2-utils: master - fsck.gfs2: Plug memory leak in check_system_dir()
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 5eb51a7d94b89a53427fff36ba041caf92d35508
Parent: 6befade37357b6fec5093b1527e113dff016028b
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Fri Jan 13 10:49:09 2012 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Fri Jan 13 10:49:09 2012 +0000
fsck.gfs2: Plug memory leak in check_system_dir()
Spotted by coverity: Variable "filename" going out of scope leaks the
storage it points to.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/pass2.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 4201bb2..c530695 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -667,6 +667,7 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
filename_len))) {
log_err( _("Unable to zero name string\n"));
stack;
+ free(filename);
return -1;
}
memcpy(filename, tmp_name, filename_len);
@@ -678,6 +679,7 @@ static int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
if (error) {
log_err(_("Error adding directory %s: %s\n"),
filename, strerror(errno));
+ free(filename);
return -errno;
}
if (cur_blks != sysinode->i_di.di_blocks)
12 years, 5 months