patch 8.1.0582: text properties are not enabled

Problem:    Text properties are not enabled.
Solution:   Fix sizeof argument and re-enable the text properties feature.
            Fix memory leak.
diff --git a/src/textprop.c b/src/textprop.c
index fa28e80..85d3247 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -151,7 +151,7 @@
     size_t	textlen;
     char_u	*props;
     char_u	*newprops;
-    static textprop_T	tmp_prop; // static to get it aligned.
+    textprop_T	tmp_prop;
     int		i;
 
     lnum = get_tv_number(&argvars[0]);
@@ -212,8 +212,9 @@
 
     // Fetch the line to get the ml_line_len field updated.
     proplen = get_text_props(buf, lnum, &props, TRUE);
+    textlen = buf->b_ml.ml_line_len - proplen * sizeof(textprop_T);
 
-    if (col >= (colnr_T)STRLEN(buf->b_ml.ml_line_ptr))
+    if (col >= (colnr_T)textlen - 1)
     {
 	EMSGN(_(e_invalid_col), (long)col);
 	return;
@@ -224,7 +225,6 @@
     if (newtext == NULL)
 	return;
     // Copy the text, including terminating NUL.
-    textlen = buf->b_ml.ml_line_len - proplen * sizeof(textprop_T);
     mch_memmove(newtext, buf->b_ml.ml_line_ptr, textlen);
 
     // Find the index where to insert the new property.
@@ -232,8 +232,8 @@
     // text, we need to copy them as bytes before using it as a struct.
     for (i = 0; i < proplen; ++i)
     {
-	mch_memmove(&tmp_prop, props + i * sizeof(proptype_T),
-							   sizeof(proptype_T));
+	mch_memmove(&tmp_prop, props + i * sizeof(textprop_T),
+							   sizeof(textprop_T));
 	if (tmp_prop.tp_col >= col)
 	    break;
     }
@@ -274,7 +274,7 @@
 }
 
 /*
- * Fetch the text properties for line "lnum" in buffer 'buf".
+ * Fetch the text properties for line "lnum" in buffer "buf".
  * Returns the number of text properties and, when non-zero, a pointer to the
  * first one in "props" (note that it is not aligned, therefore the char_u
  * pointer).
@@ -617,11 +617,13 @@
 	{
 	    *htp = (hashtab_T *)alloc(sizeof(hashtab_T));
 	    if (*htp == NULL)
+	    {
+		vim_free(prop);
 		return;
+	    }
 	    hash_init(*htp);
 	}
-	hash_add(buf == NULL ? global_proptypes : buf->b_proptypes,
-							       PT2HIKEY(prop));
+	hash_add(*htp, PT2HIKEY(prop));
     }
     else
     {
@@ -640,7 +642,7 @@
 	    char_u	*highlight;
 	    int		hl_id = 0;
 
-	    highlight = get_dict_string(dict, (char_u *)"highlight", TRUE);
+	    highlight = get_dict_string(dict, (char_u *)"highlight", FALSE);
 	    if (highlight != NULL && *highlight != NUL)
 		hl_id = syn_name2id(highlight);
 	    if (hl_id <= 0)
@@ -721,12 +723,14 @@
     if (hi != NULL)
     {
 	hashtab_T	*ht;
+	proptype_T	*prop = HI2PT(hi);
 
 	if (buf == NULL)
 	    ht = global_proptypes;
 	else
 	    ht = buf->b_proptypes;
 	hash_remove(ht, hi);
+	vim_free(prop);
     }
 }
 
@@ -846,7 +850,7 @@
 
 #if defined(EXITFREE) || defined(PROTO)
 /*
- * Free all property types for "buf".
+ * Free all global property types.
  */
     void
 clear_global_prop_types(void)