From 8a86ccf343f7cb882d886bbdd763ad31b602c944 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 14 Aug 2023 13:43:33 +0200 Subject: [PATCH] imap: add a check for failing strdup() --- lib/imap.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/imap.c b/lib/imap.c index b8c220569c..de64c2a7f2 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -1115,7 +1115,10 @@ static CURLcode imap_state_select_resp(struct Curl_easy *data, int imapcode, } else { /* Note the currently opened mailbox on this connection */ + DEBUGASSERT(!imapc->mailbox); imapc->mailbox = strdup(imap->mailbox); + if(!imapc->mailbox) + return CURLE_OUT_OF_MEMORY; if(imap->custom) result = imap_perform_list(data);