diff options
Diffstat (limited to 'authfile.c')
-rw-r--r-- | authfile.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/authfile.c b/authfile.c index 58f589a47..d67042411 100644 --- a/authfile.c +++ b/authfile.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: authfile.c,v 1.116 2015/07/09 09:49:46 markus Exp $ */ | 1 | /* $OpenBSD: authfile.c,v 1.120 2015/12/11 04:21:11 mmcc Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -243,8 +243,7 @@ sshkey_load_private_type_fd(int fd, int type, const char *passphrase, | |||
243 | /* success */ | 243 | /* success */ |
244 | r = 0; | 244 | r = 0; |
245 | out: | 245 | out: |
246 | if (buffer != NULL) | 246 | sshbuf_free(buffer); |
247 | sshbuf_free(buffer); | ||
248 | return r; | 247 | return r; |
249 | } | 248 | } |
250 | 249 | ||
@@ -272,14 +271,13 @@ sshkey_load_private(const char *filename, const char *passphrase, | |||
272 | goto out; | 271 | goto out; |
273 | } | 272 | } |
274 | if ((r = sshkey_load_file(fd, buffer)) != 0 || | 273 | if ((r = sshkey_load_file(fd, buffer)) != 0 || |
275 | (r = sshkey_parse_private_fileblob(buffer, passphrase, filename, | 274 | (r = sshkey_parse_private_fileblob(buffer, passphrase, keyp, |
276 | keyp, commentp)) != 0) | 275 | commentp)) != 0) |
277 | goto out; | 276 | goto out; |
278 | r = 0; | 277 | r = 0; |
279 | out: | 278 | out: |
280 | close(fd); | 279 | close(fd); |
281 | if (buffer != NULL) | 280 | sshbuf_free(buffer); |
282 | sshbuf_free(buffer); | ||
283 | return r; | 281 | return r; |
284 | } | 282 | } |
285 | 283 | ||
@@ -426,10 +424,8 @@ sshkey_load_cert(const char *filename, struct sshkey **keyp) | |||
426 | r = 0; | 424 | r = 0; |
427 | 425 | ||
428 | out: | 426 | out: |
429 | if (file != NULL) | 427 | free(file); |
430 | free(file); | 428 | sshkey_free(pub); |
431 | if (pub != NULL) | ||
432 | sshkey_free(pub); | ||
433 | return r; | 429 | return r; |
434 | } | 430 | } |
435 | 431 | ||
@@ -474,10 +470,8 @@ sshkey_load_private_cert(int type, const char *filename, const char *passphrase, | |||
474 | *keyp = key; | 470 | *keyp = key; |
475 | key = NULL; | 471 | key = NULL; |
476 | out: | 472 | out: |
477 | if (key != NULL) | 473 | sshkey_free(key); |
478 | sshkey_free(key); | 474 | sshkey_free(cert); |
479 | if (cert != NULL) | ||
480 | sshkey_free(cert); | ||
481 | return r; | 475 | return r; |
482 | } | 476 | } |
483 | 477 | ||
@@ -538,8 +532,7 @@ sshkey_in_file(struct sshkey *key, const char *filename, int strict_type, | |||
538 | } | 532 | } |
539 | r = SSH_ERR_KEY_NOT_FOUND; | 533 | r = SSH_ERR_KEY_NOT_FOUND; |
540 | out: | 534 | out: |
541 | if (pub != NULL) | 535 | sshkey_free(pub); |
542 | sshkey_free(pub); | ||
543 | fclose(f); | 536 | fclose(f); |
544 | return r; | 537 | return r; |
545 | } | 538 | } |