[Pkg-postgresql-public] Bug#742493: Bug#742493: Bug#742493: pgmemcache segfaults with libmemcached11

Hannu Valtonen hannu.valtonen at ohmu.fi
Thu May 8 16:13:44 UTC 2014


Hi,

http://bazaar.launchpad.net/~tangent-trunk/libmemcached/1.0/revision/1121.1.13

You're misreading the change. Basically libmemcached stopped using the 
custom memory allocator and changed to using malloc unconditionally, 
breaking backwards compatibility. Before the change it used the custom 
memory allocator which in our case was palloc.

- Hannu


On 8.5.2014 16.32, Christoph Berg wrote:
> Re: To Hannu Valtonen 2014-05-02 <20140502135529.GB14306 at msgid.df7cb.de>
>> Re: Hannu Valtonen 2014-05-02 <53639CE0.30908 at ohmu.fi>
>>> Hi,
>>>
>>> This has now been fixed by: https://github.com/ohmu/pgmemcache/commit/47623a545be485d6dd1ffb917e990d267ad57f35
> Hi,
>
> we've had a closer look at this patch. Assuming pfree() is
> PostgreSQL's free() variant (which I believe it is), it looks like
> using pfree() was wrong in the first place, and the standard libc
> free() should be used, whatever libmemcached version is used.
>
> I think the following patch does the right thing:
>
> Index: pgmemcache/pgmemcache.c
> ===================================================================
> --- pgmemcache.orig/pgmemcache.c	2014-05-08 15:25:30.260692035 +0200
> +++ pgmemcache/pgmemcache.c	2014-05-08 15:27:13.164195600 +0200
> @@ -818,10 +818,10 @@ static memcached_return_t server_stat_fu
>       {
>         char *value = memcached_stat_get_value(ptr, &stat, *stat_ptr, &rc);
>         appendStringInfo(context, "%s: %s\n", *stat_ptr, value);
> -      libmc_stat_free(value);
> +      free(value);
>       }
>   
> -  pfree(list);
> +  free(list);
>     return MEMCACHED_SUCCESS;
>   }
>   
> Index: pgmemcache/pgmemcache.h
> ===================================================================
> --- pgmemcache.orig/pgmemcache.h	2014-05-08 15:25:30.260692035 +0200
> +++ pgmemcache/pgmemcache.h	2014-05-08 15:27:13.224195312 +0200
> @@ -36,13 +36,6 @@
>   #undef PACKAGE_TARNAME
>   #undef PACKAGE_VERSION
>   
> -/* libmemcached 1.0.16 changed the allocation function for values returned from memcached_stat_get_value */
> -#if LIBMEMCACHED_VERSION_HEX >= 0x01000016
> -  #define libmc_stat_free free
> -#else
> -  #define libmc_stat_free pfree
> -#endif
> -
>   void _PG_init(void);
>   void _PG_fini(void);
>   
>
>
>> Do you plan to release a new version, or should I apply the patch to
>> the current version in Debian for now?
> Christoph



More information about the Pkg-postgresql-public mailing list