Indent.
Fix mem leak on errors.
This commit is contained in:
@@ -104,7 +104,8 @@ int _libssh2_dsa_new(libssh2_dsa_ctx **dsactx,
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = gcry_sexp_build (dsactx, NULL, "(public-key(dsa(p%b)(q%b)(g%b)(y%b)))",
|
||||
rc = gcry_sexp_build (dsactx, NULL,
|
||||
"(public-key(dsa(p%b)(q%b)(g%b)(y%b)))",
|
||||
p_len, p, q_len, q, g_len, g, y_len, y);
|
||||
if (rc)
|
||||
{
|
||||
@@ -158,8 +159,9 @@ int _libssh2_cipher_init (_libssh2_cipher_ctx *h,
|
||||
unsigned char *secret,
|
||||
int encrypt)
|
||||
{
|
||||
int mode = 0, keylen, err;
|
||||
keylen = gcry_cipher_get_algo_keylen (algo);
|
||||
int mode = 0, err;
|
||||
int keylen = gcry_cipher_get_algo_keylen (algo);
|
||||
|
||||
if (algo != GCRY_CIPHER_ARCFOUR)
|
||||
{
|
||||
mode = GCRY_CIPHER_MODE_CBC;
|
||||
@@ -174,6 +176,7 @@ int _libssh2_cipher_init (_libssh2_cipher_ctx *h,
|
||||
err = gcry_cipher_setkey (*h, secret, keylen);
|
||||
if (err)
|
||||
{
|
||||
gcry_cipher_close (*h);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -183,6 +186,7 @@ int _libssh2_cipher_init (_libssh2_cipher_ctx *h,
|
||||
err = gcry_cipher_setiv (*h, iv, blklen);
|
||||
if (err)
|
||||
{
|
||||
gcry_cipher_close (*h);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user