summaryrefslogtreecommitdiffstats
path: root/xlators/encryption/crypt/src/crypt.h
diff options
context:
space:
mode:
authorGergo Huszty <gergo.huszty@nokia.com>2018-05-16 13:28:21 +0000
committerAmar Tumballi <amarts@redhat.com>2018-05-21 07:39:14 +0000
commit7f67ddcc5c31a84a6fc296c64a0b904ff963e814 (patch)
tree5ccd3959ead93d66760cf8f2e10d43f4223b261e /xlators/encryption/crypt/src/crypt.h
parentad478b6ccb66b20f2e97d50f9ec79cfcdc4368ba (diff)
Fix for memory-leak in crypt xlator
Crypt xlator occasionaly uses local storage in it's call frame. These frames are managed with common macroes, which does not take care about cleaning up such local storages. The fix is similar to the other xlators' solution. A crypt specific macro handles the cleaning of the local storage when it is allocated. Change-Id: Ibb5b91551fbe70905e9c8c688d999fe702433e35 fixes: bz#1564419 Signed-off-by: Gergo Huszty <gergo.huszty@nokia.com>
Diffstat (limited to 'xlators/encryption/crypt/src/crypt.h')
-rw-r--r--xlators/encryption/crypt/src/crypt.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/xlators/encryption/crypt/src/crypt.h b/xlators/encryption/crypt/src/crypt.h
index 6c014535f0a..5a2b1a9cc3b 100644
--- a/xlators/encryption/crypt/src/crypt.h
+++ b/xlators/encryption/crypt/src/crypt.h
@@ -876,6 +876,19 @@ static inline mtd_op_t linkop_mtdop_dispatch(glusterfs_fop_t fop)
}
}
+#define CRYPT_STACK_UNWIND(fop, frame, params ...) \
+ do { \
+ crypt_local_t *__local = NULL; \
+ if (frame) { \
+ __local = frame->local; \
+ frame->local = NULL; \
+ } \
+ STACK_UNWIND_STRICT (fop, frame, params); \
+ if (__local) { \
+ GF_FREE (__local); \
+ } \
+ } while (0)
+
#endif /* __CRYPT_H__ */
/*