On Tue, Jun 28, 2016 at 1:26 PM, Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote: > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> > --- > diff --git a/config.c b/config.c > @@ -140,9 +141,89 @@ static int handle_path_include(const char *path, struct config_include_data *inc > +static int include_condition_is_true(const char *cond, int cond_len) > +{ > + const char *value; > + size_t value_len; > + > + /* no condition (i.e., "include.path") is always true */ > + if (!cond) > + return 1; > + > + if (skip_prefix_mem(cond, cond_len, "gitdir:", &value, &value_len)) { > + struct strbuf text = STRBUF_INIT; > + struct strbuf pattern = STRBUF_INIT; > + int ret, prefix; > + > + strbuf_add_absolute_path(&text, get_git_dir()); > + strbuf_add(&pattern, value, value_len); > + prefix = prepare_include_condition_pattern(&pattern); > + > + if (prefix < 0) > + return 0; > + > + if (prefix > 0 && > + (text.len < prefix || > + fspathncmp(pattern.buf, text.buf, prefix))) > + return 0; Are the above two "return"s leaking 'text' and 'pattern' strbufs? > + > + ret = !wildmatch(pattern.buf + prefix, text.buf + prefix, > + ignore_case ? WM_CASEFOLD : 0, > + NULL); > + strbuf_release(&pattern); > + strbuf_release(&text); > + return ret; > + } > + > + error(_("unrecognized include condition: %.*s"), cond_len, cond); > + /* unknown conditionals are always false */ > + return 0; > +} -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html