gitweb: make repeated calls to git_get_project_owner() bearable
[gitweb.git] / diffcore-pickaxe.c
index de44adabf09dcb47090e7865d6cd77677115d2b6..af9fffe6e8e145b066157da8791c749257e7c8e9 100644 (file)
@@ -14,6 +14,8 @@ static unsigned int contains(struct diff_filespec *one,
        const char *data;
        if (diff_populate_filespec(one, 0))
                return 0;
+       if (!len)
+               return 0;
 
        sz = one->size;
        data = one->data;
@@ -42,6 +44,7 @@ static unsigned int contains(struct diff_filespec *one,
                        }
                }
        }
+       diff_free_filespec_data(one);
        return cnt;
 }
 
@@ -99,7 +102,7 @@ void diffcore_pickaxe(const char *needle, int opts)
                for (i = 0; i < q->nr; i++)
                        diff_free_filepair(q->queue[i]);
        }
-       else 
+       else
                /* Showing only the filepairs that has the needle */
                for (i = 0; i < q->nr; i++) {
                        struct diff_filepair *p = q->queue[i];