Author: cem
Date: Wed Apr 20 03:48:57 2016
New Revision: 298335
URL: https://svnweb.freebsd.org/changeset/base/298335

Log:
  i915kms: Fix memory leak if a CRT is detected
  
  Reported by:  Coverity
  CID:          1090729
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/drm2/i915/intel_crt.c

Modified: head/sys/dev/drm2/i915/intel_crt.c
==============================================================================
--- head/sys/dev/drm2/i915/intel_crt.c  Wed Apr 20 03:45:45 2016        
(r298334)
+++ head/sys/dev/drm2/i915/intel_crt.c  Wed Apr 20 03:48:57 2016        
(r298335)
@@ -423,6 +423,7 @@ static bool intel_crt_detect_ddc(struct 
        struct drm_i915_private *dev_priv = crt->base.base.dev->dev_private;
        struct edid *edid;
        device_t i2c;
+       bool res = false;
 
        BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG);
 
@@ -439,7 +440,8 @@ static bool intel_crt_detect_ddc(struct 
                 */
                if (!is_digital) {
                        DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n");
-                       return true;
+                       res = true;
+                       goto out;
                }
 
                DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [EDID reports a 
digital panel]\n");
@@ -447,9 +449,10 @@ static bool intel_crt_detect_ddc(struct 
                DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [no valid EDID 
found]\n");
        }
 
+out:
        free(edid, DRM_MEM_KMS);
 
-       return false;
+       return res;
 }
 
 static enum drm_connector_status
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to