Message-ID: From: "davecramer (@davecramer)" To: "postgresql-interfaces/psqlodbc" Date: Mon, 13 May 2024 18:34:17 +0000 Subject: Re: [postgresql-interfaces/psqlodbc] issue #8: Memory leaks detected in psqlodbc library In-Reply-To: References: List-Id: X-GitHub-Author-Login: davecramer X-GitHub-Comment-Id: 2108542354 X-GitHub-Comment-Type: issue_comment X-GitHub-Issue: 8 X-GitHub-Repo: postgresql-interfaces/psqlodbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/postgresql-interfaces/psqlodbc/issues/8#issuecomment-2108542354 Content-Type: text/plain; charset=utf-8 so looking at the code ``` for (i = 0; i < self->ntables; i++) { if (coli = self->col_info[i], NULL != coli) { if (destroy || coli->refcnt == 0) { free_col_info_contents(coli); free(coli); self->col_info[i] = NULL; } else coli->acc_time = 0; } } self->ntables = 0; ``` The issue is that we set ntables to 0 regardless if the column info has been freed or not. The naive solution to this is to re-order the column info as we delete them and use the correct value for ntables. Thoughts ?