From c7ae0a71aac95d32f3f3c9ffe9b2313677ca9829 Mon Sep 17 00:00:00 2001 From: Lalatendu Mohanty Date: Mon, 6 Jan 2014 13:37:24 +0530 Subject: libgfapi : Fixing some NULL pointer dereferencing issues. 1. Fixing dereferencing null pointer "gio" 2. Checking "frame" before calling STACK_DESTROY (frame->root) Backport of patch : http://review.gluster.org/#/c/6313/ Change-Id: If2ce8804a8e9f3f99f71a8c0d13900afb5635072 Signed-off-by: Lalatendu Mohanty Reviewed-on: http://review.gluster.org/6313 Reviewed-by: Santosh Pradhan Tested-by: Gluster Build System Reviewed-by: Shyamsundar Ranganathan Reviewed-by: Raghavendra Talur Reviewed-by: Vijay Bellur Signed-off-by: Lalatendu Mohanty Reviewed-on: http://review.gluster.org/6688 --- api/src/glfs-fops.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index f3ac335fb..b09dd90f7 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -710,10 +710,14 @@ glfs_preadv_async (struct glfs_fd *glfd, const struct iovec *iovec, int count, offset, flags, NULL); out: - if (ret) { - GF_FREE (gio->iov); - GF_FREE (gio); - STACK_DESTROY (frame->root); + if (ret) { + if (gio) { + GF_FREE (gio->iov); + GF_FREE (gio); + } + if (frame) { + STACK_DESTROY (frame->root); + } glfs_subvol_done (fs, subvol); } -- cgit