summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-03-14 14:24:37 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-03-14 14:24:37 -0700
commit7aab05d2b4114c932f433a8de20707b9c56f8cd3 (patch)
tree1f375d2d0ceab6fae1c2f50124dbb204f415706f
parentMerge branch 'jk/http-no-curl-easy' (diff)
parentopen_istream(): do not dereference NULL in the error case (diff)
downloadtgif-7aab05d2b4114c932f433a8de20707b9c56f8cd3.tar.xz
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
-rw-r--r--builtin/mv.c3
-rw-r--r--notes-utils.c2
-rw-r--r--streaming.c4
-rw-r--r--utf8.c6
4 files changed, 9 insertions, 6 deletions
diff --git a/builtin/mv.c b/builtin/mv.c
index 21c46d1636..7e26eb5229 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -162,7 +162,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
if (strncmp(path, src_w_slash, len_w_slash))
break;
}
- free((char *)src_w_slash);
+ if (src_w_slash != src)
+ free((char *)src_w_slash);
if (last - first < 1)
bad = _("source directory is empty");
diff --git a/notes-utils.c b/notes-utils.c
index 2975dcd581..4aa7023903 100644
--- a/notes-utils.c
+++ b/notes-utils.c
@@ -75,7 +75,7 @@ static int notes_rewrite_config(const char *k, const char *v, void *cb)
return 0;
} else if (!c->mode_from_env && !strcmp(k, "notes.rewritemode")) {
if (!v)
- config_error_nonbool(k);
+ return config_error_nonbool(k);
c->combine = parse_combine_notes_fn(v);
if (!c->combine) {
error(_("Bad notes.rewriteMode value: '%s'"), v);
diff --git a/streaming.c b/streaming.c
index d7c9f32f0c..2ff036a0fa 100644
--- a/streaming.c
+++ b/streaming.c
@@ -152,8 +152,10 @@ struct git_istream *open_istream(const unsigned char *sha1,
if (filter) {
/* Add "&& !is_null_stream_filter(filter)" for performance */
struct git_istream *nst = attach_stream_filter(st, filter);
- if (!nst)
+ if (!nst) {
close_istream(st);
+ return NULL;
+ }
st = nst;
}
diff --git a/utf8.c b/utf8.c
index 0d20e0acb2..a831d50899 100644
--- a/utf8.c
+++ b/utf8.c
@@ -5,8 +5,8 @@
/* This code is originally from http://www.cl.cam.ac.uk/~mgk25/ucs/ */
struct interval {
- int first;
- int last;
+ ucs_char_t first;
+ ucs_char_t last;
};
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
while (1) {
size_t cnt = iconv(conv, &cp, &insz, &outpos, &outsz);
- if (cnt == -1) {
+ if (cnt == (size_t) -1) {
size_t sofar;
if (errno != E2BIG) {
free(out);