Changeset 3123
- Timestamp:
- Mar 27, 2010 3:08:08 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/ip_helper_win32.c
r3040 r3123 275 275 pj_uint8_t buffer[600]; 276 276 IP_ADAPTER_ADDRESSES *adapter = (IP_ADAPTER_ADDRESSES*)buffer; 277 void *adapterBuf = NULL; 277 278 ULONG size = sizeof(buffer); 278 279 ULONG flags; … … 288 289 if (rc == ERROR_BUFFER_OVERFLOW) { 289 290 /* Retry with larger memory size */ 290 adapter = (IP_ADAPTER_ADDRESSES*) malloc(size); 291 adapterBuf = malloc(size); 292 adapter = (IP_ADAPTER_ADDRESSES*) adapterBuf; 291 293 if (adapter != NULL) 292 294 rc = MyGetAdapterAddresses(af, flags, NULL, adapter, &size); … … 294 296 295 297 if (rc != ERROR_SUCCESS) { 296 if (adapter != (IP_ADAPTER_ADDRESSES*)buffer)297 free(adapter );298 if (adapterBuf) 299 free(adapterBuf); 298 300 return PJ_RETURN_OS_ERROR(rc); 299 301 } … … 351 353 } 352 354 353 if (adapter != (IP_ADAPTER_ADDRESSES*)buffer)354 free(adapter );355 if (adapterBuf) 356 free(adapterBuf); 355 357 356 358 *p_cnt = i;
Note: See TracChangeset
for help on using the changeset viewer.