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
This commit is contained in:
markj 2017-06-26 19:41:14 +00:00
parent 0b1b9b9cfa
commit e498e74cc8

View File

@ -2688,6 +2688,7 @@ ses_get_elm_devnames(enc_softc_t *enc, encioc_elm_devnames_t *elmdn)
sbuf_finish(&sb); sbuf_finish(&sb);
elmdn->elm_names_len = sbuf_len(&sb); elmdn->elm_names_len = sbuf_len(&sb);
copyout(sbuf_data(&sb), elmdn->elm_devnames, elmdn->elm_names_len + 1); copyout(sbuf_data(&sb), elmdn->elm_devnames, elmdn->elm_names_len + 1);
sbuf_delete(&sb);
cam_periph_lock(enc->periph); cam_periph_lock(enc->periph);
return (elmdn->elm_names_len > 0 ? 0 : ENODEV); return (elmdn->elm_names_len > 0 ? 0 : ENODEV);
} }