Re: [gnome-db] [PATCH] Fix some memory leaks



On Sun, 2008-03-16 at 13:20 -0400, Phil Longstaff wrote:
> The attached patch fixes some memory leaks.  In certain cases, the
> string returned from g_object_get() or xmlNodeGetContent() was not freed.

Thanks. Is this change meant to be in this patch? It seems unrelated.

> diff -u libgda-3.0.2.orig/libgda/gda-util.c libgda-3.0.2/libgda/gda-util.c
> --- libgda-3.0.2.orig/libgda/gda-util.c	2008-01-28 11:17:26.000000000 -0500
> +++ libgda-3.0.2/libgda/gda-util.c	2008-03-16 12:26:19.000000000 -0400
> @@ -85,7 +85,7 @@
>   * @string: string to escape
>   *
>   * Escapes @string to make it understandable by a DBMS. The escape method is very common and replaces any
> - * occurence of "'" with "\'" and "\" with "\\".
> + * occurence of "'" with "''" and "\" with "\\"
>   */
>  gchar *
>  gda_default_escape_string (const gchar *string)
> @@ -111,7 +111,12 @@
>  	ret = g_new0 (gchar, size);
>  	retptr = ret;
>  	while (*ptr) {
> -		if ((*ptr == '\'') || (*ptr == '\\')) {
> +		if (*ptr == '\'') {
> +			*retptr = '\'';
> +			*(retptr+1) = *ptr;
> +			retptr += 2;
> +		}
> +		else if (*ptr == '\\') {
>  			*retptr = '\\';
>  			*(retptr+1) = *ptr;
>  			retptr += 2;

In general, it is helpful if you can create an svn patch, also patching
the ChangeLog. And patches are less likely to be forgotten if they are
attached to a bugzilla bug.

You might want to try creating a similar patch for svn trunk too.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]