From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Price Date: Fri, 20 Jan 2012 12:39:27 +0000 Subject: [Cluster-devel] [PATCH 3/3] fsck.gfs2: Fix unchecked malloc in gfs2_dup_set() In-Reply-To: <1327063167-10291-1-git-send-email-anprice@redhat.com> References: <1327063167-10291-1-git-send-email-anprice@redhat.com> Message-ID: <1327063167-10291-3-git-send-email-anprice@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Spotted by coverity: Dereferencing a pointer that might be null "data" when calling "memset" Signed-off-by: Andrew Price --- 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. */ -- 1.7.7.5