Fix local buffer allocation conditions.

Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
diff --git a/library/ccm.c b/library/ccm.c
index af26de8..20e9414 100644
--- a/library/ccm.c
+++ b/library/ccm.c
@@ -351,8 +351,9 @@
     }
 
     /* Local output is used for decryption only. */
-    if( ctx->mode == MBEDTLS_CCM_DECRYPT || \
-        ctx->mode == MBEDTLS_CCM_STAR_DECRYPT )
+    if( local_output_len > 0 && \
+        ( ctx->mode == MBEDTLS_CCM_DECRYPT || \
+          ctx->mode == MBEDTLS_CCM_STAR_DECRYPT ) )
     {
         local_output = mbedtls_calloc( local_output_len, sizeof( *local_output) );
         if( local_output == NULL )