mattn / mattn/go-sqlite3

calling RegisterAuthorizer multiple times leaks memory

Open
#993 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
9.2k
Forks
1.2k
Avg merge
19m
Merged PRs (30d)
4

Description

When RegisterAuthorizer is called multiple times, handleVal keeps callbacks in a map until Close() is called. deleteHandles() should be called every time RegisterAuthorizer is called.

func (c *SQLiteConn) RegisterAuthorizer(callback func(int, string, string, string) int) {
	deleteHandles(c) // delete previous callback from handleVal
	if callback == nil {
		C.sqlite3_set_authorizer(c.db, nil, nil)
	} else {
		C.sqlite3_set_authorizer(c.db, (*[0]byte)(C.authorizerTrampoline), newHandle(c, callback))
	}
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the SQLiteConn.RegisterAuthorizer entry point shown in the issue and trace deleteHandles, handleVal, and newHandle. Confirm that repeated registration, including a nil callback, no longer retains the previous callback until Close(); the issue does not name a specific test or file.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sqlite
Domain
database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.