Message-ID: From: "progmachine (@progmachine)" To: "postgresql-interfaces/psqlodbc" Date: Tue, 14 May 2024 10:10:05 +0000 Subject: Re: [postgresql-interfaces/psqlodbc] PR #18: Notes todo and attempt to fix memory leak In-Reply-To: References: List-Id: X-GitHub-Author-Login: progmachine X-GitHub-Comment-Id: 1599757596 X-GitHub-Comment-Type: review_comment X-GitHub-Commit: f77bc41444c388207ffb7348b5e0c3259b09cc2e X-GitHub-Issue: 18 X-GitHub-Line: 576 X-GitHub-Path: connection.c X-GitHub-Repo: postgresql-interfaces/psqlodbc X-GitHub-Type: review_comment X-GitHub-Url: https://github.com/postgresql-interfaces/psqlodbc/pull/18#discussion_r1599757596 Content-Type: text/plain; charset=utf-8 (on connection.c:576) Potential infinite loop, if two sibling array entries is `NULL`. Potential run out of array borders, if `i` is index of last array element. ASAN will kick you in this place =) To do such algorithm of cleaning `NULL` pointers out, you need two index variables: `idst` for place you write non-null pointer, `isrc` for place you get that non-null pointer, and isrc goes forward faster than `idst`. After `isrc` reaches end of array, `idst` will be new elements count.