diff keyimport.c @ 1912:8b4274d34fe8

Use buf_burn_free() instead of two calls
author Matt Johnston <matt@ucc.asn.au>
date Tue, 29 Mar 2022 23:47:30 +0800
parents ced53051e200
children 38c6fd7d7a82
line wrap: on
line diff
--- a/keyimport.c	Tue Mar 29 23:27:55 2022 +0800
+++ b/keyimport.c	Tue Mar 29 23:47:30 2022 +0800
@@ -504,16 +504,14 @@
 	}
 
 	if (buf) {
-		buf_burn(buf);
-		buf_free(buf);
+		buf_burn_free(buf);
 	}
 	m_burn(buffer, sizeof(buffer));
 	return ret;
 
 error:
 	if (buf) {
-		buf_burn(buf);
-		buf_free(buf);
+		buf_burn_free(buf);
 	}
 	m_burn(buffer, sizeof(buffer));
 	if (ret) {
@@ -898,8 +896,7 @@
 
 	error:
 	if (blobbuf) {
-		buf_burn(blobbuf);
-		buf_free(blobbuf);
+		buf_burn_free(blobbuf);
 	}
 	m_burn(key->keyblob, key->keyblob_size);
 	m_free(key->keyblob);
@@ -1070,8 +1067,7 @@
 		outblob = (unsigned char*)m_malloc(outlen);
 		memcpy(outblob, buf->data, buf->len);
 
-		buf_burn(buf);
-		buf_free(buf);
+		buf_burn_free(buf);
 		buf = NULL;
 
 		header = "-----BEGIN OPENSSH PRIVATE KEY-----\n";
@@ -1133,12 +1129,10 @@
 		m_free(outblob);
 	}
 	if (keyblob) {
-		buf_burn(keyblob);
-		buf_free(keyblob);
+		buf_burn_free(keyblob);
 	}
 	if (extrablob) {
-		buf_burn(extrablob);
-		buf_free(extrablob);
+		buf_burn_free(extrablob);
 	}
 	return ret;
 }