Skip to content
Snippets Groups Projects
Commit 855fb1be authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Always free(mail)

I don't think this was actually a leak (since smb.msgs should be non-zero
any time mail is non-null), but to make Coverity happy (CID 515659) and just
be more fault-tolerant, always free(mail).
parent 90aadcb7
No related branches found
No related tags found
No related merge requests found
...@@ -100,7 +100,7 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode) ...@@ -100,7 +100,7 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode)
mail=loadmail(&smb,&smb.msgs,usernumber,which,lm_mode); mail=loadmail(&smb,&smb.msgs,usernumber,which,lm_mode);
last_mode = lm_mode; last_mode = lm_mode;
if(!smb.msgs) { if(!smb.msgs || mail == nullptr) {
if(which==MAIL_SENT) if(which==MAIL_SENT)
bputs(text[NoMailSent]); bputs(text[NoMailSent]);
else if(which==MAIL_ALL) else if(which==MAIL_ALL)
...@@ -109,6 +109,7 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode) ...@@ -109,6 +109,7 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode)
bprintf(text[NoMailWaiting], lm_mode&LM_UNREAD ? "un-read mail" : "mail"); bprintf(text[NoMailWaiting], lm_mode&LM_UNREAD ? "un-read mail" : "mail");
smb_close(&smb); smb_close(&smb);
smb_stack(&smb,SMB_STACK_POP); smb_stack(&smb,SMB_STACK_POP);
free(mail);
return lm_mode; return lm_mode;
} }
...@@ -793,8 +794,7 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode) ...@@ -793,8 +794,7 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode)
if(msg.total_hfields) if(msg.total_hfields)
smb_freemsgmem(&msg); smb_freemsgmem(&msg);
if(smb.msgs) free(mail);
free(mail);
/***************************************/ /***************************************/
/* Delete messages marked for deletion */ /* Delete messages marked for deletion */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment