Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jun 2017 19:41:14 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320372 - head/sys/cam/scsi
Message-ID:  <201706261941.v5QJfEP8076898@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Mon Jun 26 19:41:14 2017
New Revision: 320372
URL: https://svnweb.freebsd.org/changeset/base/320372

Log:
  Fix a memory leak in ses_get_elm_devnames().
  
  After r307132 the sbuf buffer is malloc()ed, but corresponding
  sbuf_delete() call was missing.
  
  Fix a nearby whitespace bug.
  
  MFC after:	3 days
  Sponsored by:	Dell EMC Isilon

Modified:
  head/sys/cam/scsi/scsi_enc_ses.c

Modified: head/sys/cam/scsi/scsi_enc_ses.c
==============================================================================
--- head/sys/cam/scsi/scsi_enc_ses.c	Mon Jun 26 19:40:10 2017	(r320371)
+++ head/sys/cam/scsi/scsi_enc_ses.c	Mon Jun 26 19:41:14 2017	(r320372)
@@ -2684,10 +2684,11 @@ ses_get_elm_devnames(enc_softc_t *enc, encioc_elm_devn
 	cam_periph_unlock(enc->periph);
 	sbuf_new(&sb, NULL, len, SBUF_FIXEDLEN);
 	ses_paths_iter(enc, &enc->enc_cache.elm_map[elmdn->elm_idx],
-		       ses_elmdevname_callback, &sb);
+	    ses_elmdevname_callback, &sb);
 	sbuf_finish(&sb);
 	elmdn->elm_names_len = sbuf_len(&sb);
 	copyout(sbuf_data(&sb), elmdn->elm_devnames, elmdn->elm_names_len + 1);
+	sbuf_delete(&sb);
 	cam_periph_lock(enc->periph);
 	return (elmdn->elm_names_len > 0 ? 0 : ENODEV);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706261941.v5QJfEP8076898>