Changeset 5523 in vbox for trunk/src/VBox/Frontends/VBoxBFE
- Timestamp:
- Oct 26, 2007 5:28:37 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 25743
- Location:
- trunk/src/VBox/Frontends/VBoxBFE
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxBFE/USBProxyService.cpp
r4071 r5523 302 302 } 303 303 304 /*static*/ void USBProxyService::freeInterfaceMembers (PUSBINTERFACE pIf, unsigned cIfs) 305 { 306 while (cIfs-- > 0) 307 { 308 RTMemFree (pIf->paEndpoints); 309 pIf->paEndpoints = NULL; 310 RTStrFree ((char *)pIf->pszDriver); 311 pIf->pszDriver = NULL; 312 RTStrFree ((char *)pIf->pszInterface); 313 pIf->pszInterface = NULL; 314 315 freeInterfaceMembers(pIf->paAlts, pIf->cAlts); 316 RTMemFree(pIf->paAlts); 317 pIf->paAlts = NULL; 318 pIf->cAlts = 0; 319 320 /* next */ 321 pIf++; 322 } 323 } 304 324 305 325 /*static*/ void USBProxyService::freeDevice (PUSBDEVICE pDevice) … … 309 329 while (cCfgs-- > 0) 310 330 { 311 PUSBINTERFACE pIf = pCfg->paInterfaces; 312 unsigned cIfs = pCfg->bNumInterfaces; 313 while (cIfs-- > 0) 314 { 315 RTMemFree (pIf->paEndpoints); 316 pIf->paEndpoints = NULL; 317 RTStrFree ((char *)pIf->pszDriver); 318 pIf->pszDriver = NULL; 319 RTStrFree ((char *)pIf->pszInterface); 320 pIf->pszInterface = NULL; 321 /* next */ 322 pIf++; 323 } 331 freeInterfaceMembers (pCfg->paInterfaces, pCfg->bNumInterfaces); 324 332 RTMemFree (pCfg->paInterfaces); 325 333 pCfg->paInterfaces = NULL; 334 pCfg->bNumInterfaces = 0; 335 326 336 RTStrFree ((char *)pCfg->pszConfiguration); 327 337 pCfg->pszConfiguration = NULL; -
trunk/src/VBox/Frontends/VBoxBFE/USBProxyService.h
r4071 r5523 136 136 137 137 public: 138 /** 139 * Free all the members of a USB interface returned by getDevice(). 140 * 141 * @param pIf Pointer to the interface. 142 * @param cIfs Number of consecutive interfaces pIf points to 143 */ 144 static void freeInterfaceMembers (PUSBINTERFACE pIf, unsigned cIfs); 145 138 146 /** 139 147 * Free one USB device returned by getDevice(). -
trunk/src/VBox/Frontends/VBoxBFE/USBProxyServiceLinux.cpp
r4071 r5523 840 840 { 841 841 USBINTERFACE If = {0}; 842 bool fIfAdopted = false; 842 843 while (*psz && VBOX_SUCCESS (rc)) 843 844 { … … 883 884 Assert (!If.bInterfaceNumber); Assert (!If.bAlternateSetting); 884 885 *pIf = If; 886 fIfAdopted = true; 885 887 } 886 888 else … … 895 897 pIf = &pCfg->paInterfaces[If.bInterfaceNumber]; 896 898 if (!If.bAlternateSetting) 899 { 900 freeInterfaceMembers (pIf, 1); 897 901 *pIf = If; 902 fIfAdopted = true; 903 } 898 904 else 899 905 { … … 902 908 { 903 909 pIf->paAlts = paAlts; 904 pIf = &paAlts[pIf->cAlts++]; 910 // don't do pIf = &paAlts[pIf->cAlts++]; as it will increment after the assignment 911 unsigned cAlts = pIf->cAlts++; 912 pIf = &paAlts[cAlts]; 905 913 *pIf = If; 914 fIfAdopted = true; 906 915 } 907 916 else … … 916 925 } 917 926 } 927 928 if (!fIfAdopted) 929 freeInterfaceMembers (&If, 1); 918 930 919 931 /* start anew with endpoints. */
Note:
See TracChangeset
for help on using the changeset viewer.