[EMAIL PROTECTED] wrote:
I guess my situation is an odd fringe case that probably doesn't happen too much, but I thought that knowledge of it might be useful to someone somewhere.

See PG_FREE_IF_COPY in fmgr.h


/*
 * Support for cleaning up detoasted copies of inputs.  This must only
 * be used for pass-by-ref datatypes, and normally would only be used
 * for toastable types.  If the given pointer is different from the
 * original argument, assume it's a palloc'd detoasted copy, and pfree
 * it.
 *
 * NOTE: most functions on toastable types do not have to worry about
 * this, but we currently require that support functions for indexes
 * not leak memory.
 */
#define PG_FREE_IF_COPY(ptr,n) \
    do { \
        if ((Pointer) (ptr) != PG_GETARG_POINTER(n)) \
            pfree(ptr); \
    } while (0)

Maybe you can use that or do something similar?

HTH,

Joe


---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to