aboutsummaryrefslogtreecommitdiffstats
path: root/loadparm.c
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2001-12-02 08:16:15 +0000
committerMartin Pool <mbp@samba.org>2001-12-02 08:16:15 +0000
commit1179355dab021be45e57c675b2ef1ecaa0d9c805 (patch)
treedd1cf2f2d41f5db764e121ae3d907ce69cfea803 /loadparm.c
parent3d807132e4a24f61505af76f10c396204935599f (diff)
downloadandroid_external_rsync-1179355dab021be45e57c675b2ef1ecaa0d9c805.tar.gz
android_external_rsync-1179355dab021be45e57c675b2ef1ecaa0d9c805.tar.bz2
android_external_rsync-1179355dab021be45e57c675b2ef1ecaa0d9c805.zip
Revert change from 1.39, because it causes a crash because of
attempting to free a static string. (Thankyou to Paul Mackerras.) There's still a small leak here.
Diffstat (limited to 'loadparm.c')
-rw-r--r--loadparm.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/loadparm.c b/loadparm.c
index 92b01488..f71a3bec 100644
--- a/loadparm.c
+++ b/loadparm.c
@@ -386,9 +386,16 @@ static void init_service(service *pservice)
/**
- * Assign a copy of @p v to @p *s, freeing any existing values and
- * handling NULL strings. @p *v must be initialized when this is
- * called, either to NULL or a malloc'd string.
+ * Assign a copy of @p v to @p *s. Handles NULL strings. @p *v must
+ * be initialized when this is called, either to NULL or a malloc'd
+ * string.
+ *
+ * @fixme There is a small leak here in that sometimes the existing
+ * value will be dynamically allocated, and the old copy is lost.
+ * However, we can't always deallocate the old value, because in the
+ * case of sDefault, it points to a static string. It would be nice
+ * to have either all-strdup'd values, or to never need to free
+ * memory.
**/
static void string_set(char **s, const char *v)
{
@@ -396,8 +403,6 @@ static void string_set(char **s, const char *v)
*s = NULL;
return;
}
- if (*s)
- free(*s);
*s = strdup(v);
if (!*s)
exit_cleanup(RERR_MALLOC);