Skip to content

Commit 34c1310

Browse files
committed
signature: free dup'd buffers on parse error
1 parent 4dbcf0e commit 34c1310

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/signature.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,11 @@ int git_signature__parse(git_signature *sig, const char **buffer_out,
228228
const char *time_start = email_end + 2;
229229
const char *time_end;
230230

231-
if (git__strtol64(&sig->when.time, time_start, &time_end, 10) < 0)
231+
if (git__strtol64(&sig->when.time, time_start, &time_end, 10) < 0) {
232+
git__free(sig->name);
233+
git__free(sig->email);
232234
return signature_error("invalid Unix timestamp");
235+
}
233236

234237
/* do we have a timezone? */
235238
if (time_end + 1 < buffer_end) {

0 commit comments

Comments
 (0)