提交 7aab05d2 编写于 作者: J Junio C Hamano

Merge branch 'jk/janitorial-fixes'

* jk/janitorial-fixes:
  open_istream(): do not dereference NULL in the error case
  builtin/mv: don't use memory after free
  utf8: use correct type for values in interval table
  utf8: fix iconv error detection
  notes-utils: handle boolean notes.rewritemode correctly
...@@ -162,6 +162,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix) ...@@ -162,6 +162,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
if (strncmp(path, src_w_slash, len_w_slash)) if (strncmp(path, src_w_slash, len_w_slash))
break; break;
} }
if (src_w_slash != src)
free((char *)src_w_slash); free((char *)src_w_slash);
if (last - first < 1) if (last - first < 1)
......
...@@ -75,7 +75,7 @@ static int notes_rewrite_config(const char *k, const char *v, void *cb) ...@@ -75,7 +75,7 @@ static int notes_rewrite_config(const char *k, const char *v, void *cb)
return 0; return 0;
} else if (!c->mode_from_env && !strcmp(k, "notes.rewritemode")) { } else if (!c->mode_from_env && !strcmp(k, "notes.rewritemode")) {
if (!v) if (!v)
config_error_nonbool(k); return config_error_nonbool(k);
c->combine = parse_combine_notes_fn(v); c->combine = parse_combine_notes_fn(v);
if (!c->combine) { if (!c->combine) {
error(_("Bad notes.rewriteMode value: '%s'"), v); error(_("Bad notes.rewriteMode value: '%s'"), v);
......
...@@ -152,8 +152,10 @@ struct git_istream *open_istream(const unsigned char *sha1, ...@@ -152,8 +152,10 @@ struct git_istream *open_istream(const unsigned char *sha1,
if (filter) { if (filter) {
/* Add "&& !is_null_stream_filter(filter)" for performance */ /* Add "&& !is_null_stream_filter(filter)" for performance */
struct git_istream *nst = attach_stream_filter(st, filter); struct git_istream *nst = attach_stream_filter(st, filter);
if (!nst) if (!nst) {
close_istream(st); close_istream(st);
return NULL;
}
st = nst; st = nst;
} }
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
/* This code is originally from http://www.cl.cam.ac.uk/~mgk25/ucs/ */ /* This code is originally from http://www.cl.cam.ac.uk/~mgk25/ucs/ */
struct interval { struct interval {
int first; ucs_char_t first;
int last; ucs_char_t last;
}; };
size_t display_mode_esc_sequence_len(const char *s) size_t display_mode_esc_sequence_len(const char *s)
...@@ -529,7 +529,7 @@ char *reencode_string_iconv(const char *in, size_t insz, iconv_t conv, int *outs ...@@ -529,7 +529,7 @@ char *reencode_string_iconv(const char *in, size_t insz, iconv_t conv, int *outs
while (1) { while (1) {
size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz); size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);
if (cnt == -1) { if (cnt == (size_t) -1) {
size_t sofar; size_t sofar;
if (errno != E2BIG) { if (errno != E2BIG) {
free(out); free(out);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册