rem: out_buf = icalmemory_tmp_buffer(strlen(buf));
add: out_buf = icalmemory_tmp_buffer(strlen(buf)+1);
context: icalparameter_as_ical_string (icalparameter* parameter){    struct icalparameter_impl* impl;    size_t buf_size = 1024;    char* buf;     char* buf_ptr;    char *out_buf;    const char *kind_string;    icalerror_check_arg_rz( (parameter!=0), "parameter");    /* Create new buffer that we can append names, parameters and a       value to, and reallocate as needed. Later, this buffer will be       copied to a icalmemory_tmp_buffer, which is managed internally       by libical, so it can be given to the caller without fear of       the caller forgetting to free it */    buf = icalmemory_new_buffer(buf_size);    buf_ptr = buf;    impl = (struct icalparameter_impl*)parameter;    if(impl->kind == ICAL_X_PARAMETER) {	icalmemory_append_string(&buf, &buf_ptr, &buf_size, 				 icalparameter_get_xname(impl));    } else {	kind_string = icalparameter_kind_to_string(impl->kind);		if (impl->kind == ICAL_NO_PARAMETER || 	    impl->kind == ICAL_ANY_PARAMETER || 	    kind_string == 0)	{	    icalerror_set_errno(ICAL_BADARG_ERROR);	    return 0;	}			/* Put the parameter name into the string */	icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);    }    icalmemory_append_string(&buf, &buf_ptr, &buf_size, "=");    if(impl->string !=0){        icalmemory_append_string(&buf, &buf_ptr, &buf_size, impl->string);     } else if (impl->data != 0){        const char* str = icalparameter_enum_to_string(impl->data);        icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);     } else {        icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);        return 0;    }    /* Now, copy the buffer to a tmp_buffer, which is safe to give to       the caller without worring about de-allocating it. */        out_buf = icalmemory_tmp_buffer(strlen(buf));    strcpy(out_buf, buf);    icalmemory_free_buffer(buf);    return out_buf;}