aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Petter Jansson <hpj@ximian.com>2003-03-18 09:48:41 +0800
committerHans Petter <hansp@src.gnome.org>2003-03-18 09:48:41 +0800
commit93e6b5f8f49e61cd1153626afd3026efba19e1f1 (patch)
tree22dab7c3741e4521b46f47b827fd97a73ded47e2
parent76d5d480974306cceaa4770620936d19a9b6170d (diff)
downloadgsoc2013-evolution-93e6b5f8f49e61cd1153626afd3026efba19e1f1.tar
gsoc2013-evolution-93e6b5f8f49e61cd1153626afd3026efba19e1f1.tar.gz
gsoc2013-evolution-93e6b5f8f49e61cd1153626afd3026efba19e1f1.tar.bz2
gsoc2013-evolution-93e6b5f8f49e61cd1153626afd3026efba19e1f1.tar.lz
gsoc2013-evolution-93e6b5f8f49e61cd1153626afd3026efba19e1f1.tar.xz
gsoc2013-evolution-93e6b5f8f49e61cd1153626afd3026efba19e1f1.tar.zst
gsoc2013-evolution-93e6b5f8f49e61cd1153626afd3026efba19e1f1.zip
Part of fix for #34095
2003-03-17 Hans Petter Jansson <hpj@ximian.com> Part of fix for #34095 * scripts/mkderivedparameters.pl: Generate code to free old string value when a new one is set. * src/libical/icalperiod.c (icalperiodtype_as_ical_string): Callers expect a temporary string, and thus won't free it, so allocate returned memory from the temporary ring. svn path=/trunk/; revision=20330
-rw-r--r--libical/ChangeLog11
-rwxr-xr-xlibical/scripts/mkderivedparameters.pl4
-rw-r--r--libical/src/libical/icalperiod.c5
3 files changed, 17 insertions, 3 deletions
diff --git a/libical/ChangeLog b/libical/ChangeLog
index 0afb79e364..8d9542b7a3 100644
--- a/libical/ChangeLog
+++ b/libical/ChangeLog
@@ -1,3 +1,14 @@
+2003-03-17 Hans Petter Jansson <hpj@ximian.com>
+
+ Part of fix for #34095
+
+ * scripts/mkderivedparameters.pl: Generate code to free old
+ string value when a new one is set.
+
+ * src/libical/icalperiod.c (icalperiodtype_as_ical_string):
+ Callers expect a temporary string, and thus won't free it, so
+ allocate returned memory from the temporary ring.
+
2003-02-10 Ettore Perazzoli <ettore@ximian.com>
* src/libical/Makefile.am (libical_static_la_DEPENDENCIES): Make
diff --git a/libical/scripts/mkderivedparameters.pl b/libical/scripts/mkderivedparameters.pl
index 5772065ec4..89f25306a5 100755
--- a/libical/scripts/mkderivedparameters.pl
+++ b/libical/scripts/mkderivedparameters.pl
@@ -188,7 +188,9 @@ foreach $param (keys %params){
$charorenum = " icalerror_check_arg_rz( (param!=0), \"param\");\n return ($type)((struct icalparameter_impl*)param)->string;";
- $set_code = "((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);";
+ $set_code = "if (((struct icalparameter_impl*)param)->string != 0)\n" .
+ " free((void *) ((struct icalparameter_impl*)param)->string);\n" .
+ " ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);";
$pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");";
$pointer_check_v = "icalerror_check_arg_rv( (v!=0),\"v\");";
diff --git a/libical/src/libical/icalperiod.c b/libical/src/libical/icalperiod.c
index 6117df526f..b8c8cad1a5 100644
--- a/libical/src/libical/icalperiod.c
+++ b/libical/src/libical/icalperiod.c
@@ -137,8 +137,9 @@ const char* icalperiodtype_as_ical_string(struct icalperiodtype p)
icalmemory_append_string(&buf, &buf_ptr, &buf_size, end);
-
- return buf;
+ buf_ptr = icalmemory_tmp_copy (buf);
+ icalmemory_free_buffer (buf);
+ return buf_ptr;
}