diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
index 7664acc..b568c50 100644
--- a/gst/isomp4/qtdemux.c
+++ b/gst/isomp4/qtdemux.c
@@ -2467,9 +2467,8 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
   const gchar *system_id;
   gboolean uses_sub_sample_encryption = FALSE;
 
-  if (!qtdemux->streams) {
+  if (!qtdemux->streams)
     return;
-  }
 
   stream = qtdemux->streams[0];
 
@@ -2487,10 +2486,8 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
   stream->protected = TRUE;
   stream->protection_scheme_type = FOURCC_cenc;
 
-  if (!stream->protection_scheme_info) {
-    stream->protection_scheme_info =
-        g_malloc0 (sizeof (QtDemuxCencSampleSetInfo));
-  }
+  if (!stream->protection_scheme_info)
+    stream->protection_scheme_info = g_new0 (QtDemuxCencSampleSetInfo, 1);
 
   ss_info = (QtDemuxCencSampleSetInfo *) stream->protection_scheme_info;
 
@@ -2504,6 +2501,7 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
   if (ss_info->crypto_info) {
     GST_LOG_OBJECT (qtdemux, "unreffing existing crypto_info");
     g_ptr_array_free (ss_info->crypto_info, TRUE);
+    ss_info->crypto_info = NULL;
   }
 
   /* skip UUID */
@@ -2519,7 +2517,7 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
     return;
   }
 
-  if (flags & 0x000001) {
+  if ((flags & 0x000001)) {
     guint32 algorithm_id = 0;
     const guint8 *kid;
     GstBuffer *kid_buf;
@@ -2541,13 +2539,11 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
       GST_DEBUG_OBJECT (qtdemux, "AES 128-bits CBC encrypted stream");
     }
 
-    if (!gst_byte_reader_get_uint8 (&br, &iv_size)) {
+    if (!gst_byte_reader_get_uint8 (&br, &iv_size))
       return;
-    }
 
-    if (!gst_byte_reader_get_data (&br, 16, &kid)) {
+    if (!gst_byte_reader_get_data (&br, 16, &kid))
       return;
-    }
 
     kid_buf = gst_buffer_new_allocate (NULL, 16, NULL);
     gst_buffer_fill (kid_buf, 0, kid, 16);
@@ -2561,8 +2557,9 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
     GST_DEBUG_OBJECT (qtdemux, "default sample properties: "
         "is_encrypted=%u, iv_size=%u", is_encrypted, iv_size);
     gst_buffer_unref (kid_buf);
-  } else if (flags & 0x000002)
+  } else if ((flags & 0x000002)) {
     uses_sub_sample_encryption = TRUE;
+  }
 
   if (!gst_byte_reader_get_uint32_be (&br, &qtdemux->cenc_aux_sample_count)) {
     GST_ERROR_OBJECT (qtdemux, "Error getting box's sample count field");
@@ -2590,10 +2587,6 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
       return;
     }
     buf = gst_buffer_new_wrapped (data, iv_size);
-    if (!buf) {
-      gst_structure_free (properties);
-      return;
-    }
     gst_structure_set (properties, "iv", GST_TYPE_BUFFER, buf, NULL);
     gst_buffer_unref (buf);
 
@@ -2601,7 +2594,7 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
       guint16 n_subsamples;
 
       if (!gst_byte_reader_get_uint16_be (&br, &n_subsamples)
-          || !(n_subsamples > 0)) {
+          || n_subsamples == 0) {
         GST_ERROR_OBJECT (qtdemux,
             "failed to get subsample count for sample %u", i);
         gst_structure_free (properties);
@@ -2615,10 +2608,6 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length,
         return;
       }
       buf = gst_buffer_new_wrapped (data, n_subsamples * 6);
-      if (!buf) {
-        gst_structure_free (properties);
-        return;
-      }
       gst_structure_set (properties,
           "subsample_count", G_TYPE_UINT, n_subsamples,
           "subsamples", GST_TYPE_BUFFER, buf, NULL);
