const char* kind_string;
- buf = icalmemory_new_buffer(buf_size);
- buf_ptr = buf;
-
icalerror_check_arg_rz( (component!=0), "component");
icalerror_check_arg_rz( (kind!=ICAL_NO_COMPONENT), "component kind is ICAL_NO_COMPONENT");
icalerror_check_arg_rz( (kind_string!=0),"Unknown kind of component");
+ buf = icalmemory_new_buffer(buf_size);
+ buf_ptr = buf;
+
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "BEGIN:");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
out_buf = icalmemory_tmp_copy(buf);
- free(buf);
+ icalmemory_free_buffer(buf);
return out_buf;
}