Blob Blame History Raw
From acc0bce5d5b32611c315db9ab825287284287a63 Mon Sep 17 00:00:00 2001
From: Niels de Vos <ndevos@redhat.com>
Date: Fri, 18 Nov 2016 14:39:34 +0100
Subject: [PATCH 183/206] Undo revert: "gfapi/upcall: Use GF_CALLOC while
 allocating variables"

This reverts commit b945e99a6c5a9ea623b2c9d0dbc1417ef8e59d4b. The
variables and structures need to be allocated with GF_CALLOC() so that
applications can free the memory with glfs_free() correctly.

BUG: 1386635
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Change-Id: I38bdd594c00ac60f4ad711ec2bd1c4e582497475
Reviewed-on: https://code.engineering.redhat.com/gerrit/90576
Reviewed-by: Soumya Koduri <skoduri@redhat.com>
Tested-by: Soumya Koduri <skoduri@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 api/src/glfs-handleops.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c
index 221c29f..f9b4ee9 100644
--- a/api/src/glfs-handleops.c
+++ b/api/src/glfs-handleops.c
@@ -1891,7 +1891,8 @@ glfs_h_poll_cache_invalidation (struct glfs *fs,
                 goto out;
         }
 
-        up_inode_arg = calloc (1, sizeof (struct callback_inode_arg));
+        up_inode_arg = GF_CALLOC (1, sizeof (struct callback_inode_arg),
+                                  glfs_mt_upcall_entry_t);
         GF_VALIDATE_OR_GOTO ("glfs_h_poll_cache_invalidation",
                              up_inode_arg, out);
 
@@ -1957,8 +1958,7 @@ out:
 
                 /* Reset event_arg as well*/
                 up_arg->event_arg = NULL;
-                free (up_inode_arg);
-                up_inode_arg = NULL;
+                GF_FREE (up_inode_arg);
         }
         return ret;
 }
-- 
2.9.3