From 259132b7e7a691cef4bbbda567c72f405f30ec09 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sun, 26 Dec 2021 19:14:01 +0100 Subject: [PATCH] plug memory leaks in imap_{store,trash}_msg() error paths --- src/drv_imap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/drv_imap.c b/src/drv_imap.c index 06d807b..d760eaf 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -3214,6 +3214,7 @@ imap_trash_msg( store_t *gctx, message_t *msg, cmd->param.to_trash = 1; if (prepare_trash( &buf, ctx ) < 0) { cb( DRV_BOX_BAD, aux ); + free( cmd ); return; } imap_exec( ctx, &cmd->gen, imap_done_simple_msg, @@ -3252,11 +3253,13 @@ imap_store_msg( store_t *gctx, msg_data_t *data, int to_trash, cmd->param.to_trash = 1; if (prepare_trash( &buf, ctx ) < 0) { cb( DRV_BOX_BAD, 0, aux ); + free( cmd ); return; } } else { if (prepare_box( &buf, ctx ) < 0) { cb( DRV_BOX_BAD, 0, aux ); + free( cmd ); return; } }