From: Heikki Linnakangas Date: Thu, 19 May 2011 02:30:24 +0000 (-0400) Subject: Replace strdup() with pstrdup(), to avoid leaking memory. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=4919a20c3331dbecd170387b58075210d6245f51;p=users%2Fc2main%2Fpostgres.git Replace strdup() with pstrdup(), to avoid leaking memory. It's been like this since the seg module was introduced, so backpatch to 8.2 which is the oldest supported version. --- diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c index 3354a90094..f9b9d93af0 100644 --- a/contrib/seg/seg.c +++ b/contrib/seg/seg.c @@ -929,7 +929,7 @@ restore(char *result, float val, int n) *p = '\0'; /* get the exponent */ - mant = (char *) strtok(strdup(result), "e"); + mant = (char *) strtok(pstrdup(result), "e"); exp = atoi(strtok(NULL, "e")); if (exp == 0)