Skip to content

Commit 0a70b0e

Browse files
committed
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.
1 parent a217cb1 commit 0a70b0e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

apache2/msc_status_engine.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ int DSOLOCAL msc_status_engine_mac_address (unsigned char *mac)
182182
(unsigned char)LLADDR(sdl)[3],
183183
(unsigned char)LLADDR(sdl)[4],
184184
(unsigned char)LLADDR(sdl)[5]);
185-
goto end;
185+
break;
186186
}
187187
}
188188

@@ -225,7 +225,7 @@ int DSOLOCAL msc_status_engine_mac_address (unsigned char *mac)
225225
(unsigned char)ifr->ifr_addr.sa_data[4],
226226
(unsigned char)ifr->ifr_addr.sa_data[5]);
227227

228-
goto end;
228+
break;
229229
}
230230
}
231231
close( sock );
@@ -268,15 +268,14 @@ int DSOLOCAL msc_status_engine_mac_address (unsigned char *mac)
268268
(unsigned char)pAdapter->Address[3],
269269
(unsigned char)pAdapter->Address[4],
270270
(unsigned char)pAdapter->Address[5]);
271-
goto end;
271+
break;
272272
}
273273
pAdapter = pAdapter->Next;
274274
}
275275

276276
free(pAdapterInfo);
277277
#endif
278278

279-
end:
280279
return 0;
281280
failed:
282281
return -1;

0 commit comments

Comments
 (0)