Fix (unreported) potential leak in Main freeing function.

Could happen in case a 'split-by-libraries' Main is passed to
`BKE_main_free`.
This commit is contained in:
Bastien Montagne 2023-02-22 16:37:15 +01:00
parent a7633d6b57
commit 6eb89d115f

View file

@ -52,6 +52,13 @@ Main *BKE_main_new(void)
void BKE_main_free(Main *mainvar)
{
/* In case this is called on a 'split-by-libraries' list of mains.
*
* Should not happen in typical usages, but can occur e.g. if a file reading is aborted. */
if (mainvar->next) {
BKE_main_free(mainvar->next);
}
/* also call when reading a file, erase all, etc */
ListBase *lbarray[INDEX_ID_MAX];
int a;