strbuf: instate cleanup rule in case of non-memory errors
[gitweb.git] / ws.c
diff --git a/ws.c b/ws.c
index 7a7ff130a34942506e6068105ac5946c9404bf18..b1efcd9d753a29d295702b36fb1beba58fb16995 100644 (file)
--- a/ws.c
+++ b/ws.c
@@ -99,8 +99,7 @@ unsigned whitespace_rule(const char *pathname)
 /* The returned string should be freed by the caller. */
 char *whitespace_error_string(unsigned ws)
 {
-       struct strbuf err;
-       strbuf_init(&err, 0);
+       struct strbuf err = STRBUF_INIT;
        if (ws & WS_TRAILING_SPACE)
                strbuf_addstr(&err, "trailing whitespace");
        if (ws & WS_SPACE_BEFORE_TAB) {