mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-16 07:56:12 +03:00
Fix resource leaks in msc_status_engine_mac_address
`goto end` jumped over freeing/releasing resources for all platforms. For Linux, this caused a leak of open socket. For other platforms, it's just a memory leak.
This commit is contained in:
parent
a217cb1056
commit
0a70b0e343
@ -182,7 +182,7 @@ int DSOLOCAL msc_status_engine_mac_address (unsigned char *mac)
|
|||||||
(unsigned char)LLADDR(sdl)[3],
|
(unsigned char)LLADDR(sdl)[3],
|
||||||
(unsigned char)LLADDR(sdl)[4],
|
(unsigned char)LLADDR(sdl)[4],
|
||||||
(unsigned char)LLADDR(sdl)[5]);
|
(unsigned char)LLADDR(sdl)[5]);
|
||||||
goto end;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ int DSOLOCAL msc_status_engine_mac_address (unsigned char *mac)
|
|||||||
(unsigned char)ifr->ifr_addr.sa_data[4],
|
(unsigned char)ifr->ifr_addr.sa_data[4],
|
||||||
(unsigned char)ifr->ifr_addr.sa_data[5]);
|
(unsigned char)ifr->ifr_addr.sa_data[5]);
|
||||||
|
|
||||||
goto end;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close( sock );
|
close( sock );
|
||||||
@ -268,7 +268,7 @@ int DSOLOCAL msc_status_engine_mac_address (unsigned char *mac)
|
|||||||
(unsigned char)pAdapter->Address[3],
|
(unsigned char)pAdapter->Address[3],
|
||||||
(unsigned char)pAdapter->Address[4],
|
(unsigned char)pAdapter->Address[4],
|
||||||
(unsigned char)pAdapter->Address[5]);
|
(unsigned char)pAdapter->Address[5]);
|
||||||
goto end;
|
break;
|
||||||
}
|
}
|
||||||
pAdapter = pAdapter->Next;
|
pAdapter = pAdapter->Next;
|
||||||
}
|
}
|
||||||
@ -276,7 +276,6 @@ int DSOLOCAL msc_status_engine_mac_address (unsigned char *mac)
|
|||||||
free(pAdapterInfo);
|
free(pAdapterInfo);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
end:
|
|
||||||
return 0;
|
return 0;
|
||||||
failed:
|
failed:
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user