[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] fix sqlite error message leak

From: Daniel Rall <dlr_at_collab.net>
Date: 2007-06-07 18:12:36 CEST

Patch looks conceptually great, but the formatting's inconsistent with
SVN's style. +1 to commit after tweaking that.

On Thu, 07 Jun 2007, David Glasser wrote:

> Reading through the sqlite3 API, it appears that the caller of
> sqlite3_exec is responsible for freeing any error message string that
> is returned. The following patch does this for the mergeinfo code.
> Since this is my first time working with the mergeinfo code or sqlite3
> in general, I'm posting this for review instead of just committing.
>
> --dave
>
> [[[
> * subversion/libsvn_fs_util/mergeinfo-sqlite-index.c
> (util_sqlite_exec): Don't leak the error string returned from
> sqlite3_exec.
> ]]]
>
> --
> David Glasser | glasser_at_mit.edu | http://www.davidglasser.net/

> === subversion/libsvn_fs_util/mergeinfo-sqlite-index.c
> ==================================================================
> --- subversion/libsvn_fs_util/mergeinfo-sqlite-index.c (revision 148209)
> +++ subversion/libsvn_fs_util/mergeinfo-sqlite-index.c (local)
> @@ -71,8 +71,12 @@
> void *callbackdata)
> {
> char *err_msg;
> - if (sqlite3_exec(db, sql, NULL, NULL, &err_msg) != SQLITE_OK)
> - return svn_error_create(SVN_ERR_FS_SQLITE_ERROR, NULL, err_msg);
> + svn_error_t *err;
> + if (sqlite3_exec(db, sql, NULL, NULL, &err_msg) != SQLITE_OK) {
> + err = svn_error_create(SVN_ERR_FS_SQLITE_ERROR, NULL, err_msg);
> + sqlite3_free(err_msg);
> + return err;
> + }
> return SVN_NO_ERROR;
> }
>

  • application/pgp-signature attachment: stored
Received on Thu Jun 7 18:14:02 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.