[YAMos-dev] Preventing use of invalid pointers

Hi,

I just notice that Thore Böckelmann fixed a bug (or potential bug) in
YAM_MA.c concerning the fact that after calling 
MA_DeleteSingle(struct Mail *mail, ...), the pointer mail is invalid, since
the Mail structure it pointed to has been free()'d.

The same pitfall is behind the two "readwindow close" bugs described in 
#1460858.
I wonder if some more systematic measure may be taken to prevent future bugs
caused by this free()-ing?

Passing the Mail pointer by reference and letting MA_DeleteSingle() set it
to NULL would solve only part of the problem, since one can always make a
copy of the pointer (or some other pointer inside the struct Mail) prior to
the call...

Since I am not a developer, I do not know the typical strategies used to
avoid this kind of problems, but I am sure You guys could come up with
a solution.

Regards,
_______________________________________________________________________
YAM developer mailing list - http://www.freelists.org/list/yamos-dev
Listserver help...: mailto:yamos-dev-request@xxxxxxxxxxxxx?subject=HELP
Unsubscribe: mailto:yamos-dev-request@xxxxxxxxxxxxx?subject=UNSUBSCRIBE

Other related posts: