Index: libyaml/trunk/src/api.c
===================================================================
--- libyaml/trunk/src/api.c	(revision 211)
+++ libyaml/trunk/src/api.c	(revision 212)
@@ -58,8 +58,11 @@
  */
 
-YAML_DECLARE(char *)
-yaml_strdup(const char *str)
-{
-    return strdup(str);
+YAML_DECLARE(yaml_char_t *)
+yaml_strdup(const yaml_char_t *str)
+{
+    if (!str)
+        return NULL;
+
+    return (yaml_char_t *)strdup((char *)str);
 }
 
@@ -390,4 +393,5 @@
     }
     STACK_DEL(emitter, emitter->indents);
+    yaml_event_delete(&emitter->event);
     while (!STACK_EMPTY(empty, emitter->tag_directives)) {
         yaml_tag_directive_t tag_directive = POP(emitter, emitter->tag_directives);
@@ -537,5 +541,5 @@
     assert(emitter);    /* Non-NULL emitter object expected. */
 
-    emitter->best_width = (width > 0) ? width : 0;
+    emitter->best_width = (width >= 0) ? width : -1;
 }
 
