aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Willmann <d.willmann@samsung.com>2013-03-19 16:28:37 +0000
committerChris Michael <cp.michael@samsung.com>2013-03-26 08:53:33 +0000
commit23302c3acbcb8ce8c4e021e00530090bdcd92e0d (patch)
tree9d4da7ce1f90a86df6471751c2714f722fe625b5
parentecore_coroutine: Silence warning in clang (diff)
downloadefl-23302c3acbcb8ce8c4e021e00530090bdcd92e0d.tar.gz
eet_cipher: Fix initialization of opened variable
In the error case we 'goto' the error path directly without passing through the declaration and initialization of the variable. This doesn't work so move the declaration/initialization to the start. See this example (compile with -Wall for the warning): ----- #include <stdio.h> int main(void) { goto bar; int i = 15; bar: printf("Foo: %i\n", i); return 0; } ---- Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
-rw-r--r--src/lib/eet/eet_cipher.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/eet/eet_cipher.c b/src/lib/eet/eet_cipher.c
index f805ba7c0b..2dd4d07872 100644
--- a/src/lib/eet/eet_cipher.c
+++ b/src/lib/eet/eet_cipher.c
@@ -1070,6 +1070,7 @@ eet_decipher(const void *data,
unsigned int salt;
int tmp_len;
int tmp = 0;
+ int opened = 0;
/* At least the salt and an AES block */
if (size < sizeof(unsigned int) + 16)
@@ -1129,7 +1130,6 @@ eet_decipher(const void *data,
# else /* ifdef HAVE_GNUTLS */
EVP_CIPHER_CTX ctx;
- int opened = 0;
/* Openssl create the corresponding cipher */
EVP_CIPHER_CTX_init(&ctx);
@@ -1178,6 +1178,7 @@ on_error:
memset(ik, 0, sizeof (ik));
# ifdef HAVE_GNUTLS
+ (void)opened;
# else
if (opened)
EVP_CIPHER_CTX_cleanup(&ctx);