builtin-checkout.c: check error return from read_cache()
[gitweb.git] / combine-diff.c
index de83c6972e9dffbd634e5cc09b5e455ec22c6c48..ec8df39bb01347eb035ad94553357b80af652b78 100644 (file)
@@ -213,6 +213,7 @@ static void combine_diff(const unsigned char *parent, mmfile_t *result_file,
 
        parent_file.ptr = grab_blob(parent, &sz);
        parent_file.size = sz;
+       memset(&xpp, 0, sizeof(xpp));
        xpp.flags = XDF_NEED_MINIMAL;
        memset(&xecfg, 0, sizeof(xecfg));
        memset(&state, 0, sizeof(state));
@@ -742,9 +743,8 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
 
                        /* If not a fake symlink, apply filters, e.g. autocrlf */
                        if (is_file) {
-                               struct strbuf buf;
+                               struct strbuf buf = STRBUF_INIT;
 
-                               strbuf_init(&buf, 0);
                                if (convert_to_git(elem->path, result, len, &buf, safe_crlf)) {
                                        free(result);
                                        result = strbuf_detach(&buf, &len);