Index: src/OFMutableString.m ================================================================== --- src/OFMutableString.m +++ src/OFMutableString.m @@ -237,12 +237,11 @@ if (fmt == nil) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; if ((len = of_vasprintf(&t, [fmt cString], args)) == -1) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidFormatException newWithClass: isa]; @try { [self appendCString: t withLength: len]; } @finally { Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -684,12 +684,11 @@ if (fmt == nil) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; if ((len = of_vasprintf(&t, [fmt cString], args)) == -1) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidFormatException newWithClass: isa]; @try { return [self writeNBytes: len fromBuffer: t]; } @finally { Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -486,12 +486,11 @@ if (fmt == nil) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; if ((len = of_vasprintf(&string, [fmt cString], args)) == -1) - @throw [OFInvalidArgumentException newWithClass: isa - selector: _cmd]; + @throw [OFInvalidFormatException newWithClass: isa]; @try { length = len; switch (of_string_check_utf8(string, length)) { Index: src/of_asprintf.m ================================================================== --- src/of_asprintf.m +++ src/of_asprintf.m @@ -251,12 +251,12 @@ [[obj description] cString]); else if (!append_str(ctx, "(nil)", 5)) return false; } @catch (id e) { - [e release]; - return false; + free(ctx->buf); + @throw e; } @finally { [pool release]; } break; @@ -486,21 +486,17 @@ if ((ctx.buf = malloc(1)) == NULL) return -1; for (ctx.i = 0; ctx.i < ctx.fmt_len; ctx.i++) { if (!states[ctx.state](&ctx)) { - if (ctx.buf != NULL) - free(ctx.buf); - + free(ctx.buf); return -1; } } if (ctx.state != STATE_STRING) { - if (ctx.buf != NULL) - free(ctx.buf); - + free(ctx.buf); return -1; } if (!append_str(&ctx, ctx.fmt + ctx.last, ctx.fmt_len - ctx.last)) { free(ctx.buf);