check-ref-format: release strbuf after use in check_ref_format_branch()
[gitweb.git] / credential.c
index 67a523353b105764783b683a23b51d7d6a3bfda3..9747f47b18bf2e622f11f41889faaa4b1845ac8d 100644 (file)
@@ -94,8 +94,7 @@ static void credential_apply_config(struct credential *c)
        c->configured = 1;
 
        if (!c->use_http_path && proto_is_http(c->protocol)) {
-               free(c->path);
-               c->path = NULL;
+               FREE_AND_NULL(c->path);
        }
 }
 
@@ -315,10 +314,8 @@ void credential_reject(struct credential *c)
        for (i = 0; i < c->helpers.nr; i++)
                credential_do(c, c->helpers.items[i].string, "erase");
 
-       free(c->username);
-       c->username = NULL;
-       free(c->password);
-       c->password = NULL;
+       FREE_AND_NULL(c->username);
+       FREE_AND_NULL(c->password);
        c->approved = 0;
 }