Fix possible memory leak in <MD>_ext()
diff --git a/library/sha256.c b/library/sha256.c
index 16a2f0b..fb03cd1 100644
--- a/library/sha256.c
+++ b/library/sha256.c
@@ -355,17 +355,18 @@
     mbedtls_sha256_init( &ctx );
 
     if( ( ret = mbedtls_sha256_starts_ext( &ctx, is224 ) ) != 0 )
-            return( ret );
+        goto exit;
 
     if( ( ret = mbedtls_sha256_update_ext( &ctx, input, ilen ) ) != 0 )
-            return( ret );
+        goto exit;
 
     if( ( ret = mbedtls_sha256_finish_ext( &ctx, output ) ) != 0 )
-            return( ret );
+        goto exit;
 
+exit:
     mbedtls_sha256_free( &ctx );
 
-    return( 0 );
+    return( ret );
 }
 
 #if defined(MBEDTLS_SELF_TEST)