From: Duy Nguyen Date: Tue, 03 Jan 2017 12:06:22 GMT Subject: Re: [PATCH v3 06/16] pathspec: copy and free owned memory Message-ID: In-Reply-To: <1481670870-66754-7-git-send-email-bmwill@google.com> On Wed, Dec 14, 2016 at 6:14 AM, Brandon Williams wrote: > void clear_pathspec(struct pathspec *pathspec) > { > + int i; > + > + for (i = 0; i < pathspec->nr; i++) { > + free(pathspec->items[i].match); > + free(pathspec->items[i].original); > + } > free(pathspec->items); > pathspec->items = NULL; We should set pathspec->nr to zero so that calling this function again won't cause any harm. > } -- Duy