File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
components/drivers/usb/usbhost/core Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,10 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device)
162162
163163 /* alloc memory for configuration descriptor */
164164 device -> cfg_desc = (ucfg_desc_t )rt_malloc (cfg_desc .wTotalLength );
165+ if (device -> cfg_desc == RT_NULL )
166+ {
167+ return RT_ENOMEM ;
168+ }
165169 rt_memset (device -> cfg_desc , 0 , cfg_desc .wTotalLength );
166170
167171 /* get full configuration descriptor */
@@ -219,6 +223,10 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device)
219223 {
220224 /* allocate memory for interface device */
221225 device -> intf [i ] = (struct uhintf * )rt_malloc (sizeof (struct uhintf ));
226+ if (device -> intf [i ] == RT_NULL )
227+ {
228+ return RT_ENOMEM ;
229+ }
222230 device -> intf [i ]-> drv = drv ;
223231 device -> intf [i ]-> device = device ;
224232 device -> intf [i ]-> intf_desc = intf_desc ;
You can’t perform that action at this time.
0 commit comments