Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=efb... Commit: efb0ea4ed013a9d505e31734f4c2e0b9aff763ec Parent: 968f58cbdf01f6e8f3b7f3024556b5d7d5237b88 Author: Andrew Price anprice@redhat.com AuthorDate: Fri Jan 20 12:27:16 2012 +0000 Committer: Andrew Price anprice@redhat.com CommitterDate: Fri Jan 20 12:27:16 2012 +0000
fsck.gfs2: Fix unchecked malloc in gfs2_dup_set()
Spotted by coverity: Dereferencing a pointer that might be null "data" when calling "memset"
Signed-off-by: Andrew Price anprice@redhat.com --- gfs2/fsck/util.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c index f37fe7d..6c80ae8 100644 --- a/gfs2/fsck/util.c +++ b/gfs2/fsck/util.c @@ -253,6 +253,10 @@ static struct duptree *gfs2_dup_set(uint64_t dblock, int create) if (!create) return NULL; data = malloc(sizeof(struct duptree)); + if (data == NULL) { + log_crit( _("Unable to allocate duptree structure\n")); + return NULL; + } dups_found++; memset(data, 0, sizeof(struct duptree)); /* Add new node and rebalance tree. */
cluster-commits@lists.fedorahosted.org