openh264
openh264 copied to clipboard
[PATCH] resource leaks in codec/console/enc/src/welsenc.cpp
Please review the attached patch. It fixes two resource leaks in codec/console/enc/src/welsenc.cpp:
diff --git a/codec/console/enc/src/welsenc.cpp b/codec/console/enc/src/welsenc.cpp
index fb0663c..f7b0270 100644
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -909,11 +909,13 @@ int ProcessEncodingSvcWithParam (ISVCEncoder* pPtrEnc, int argc, char** argv) {
int iParsedNum = 3;
if (ParseCommandLine (argc - iParsedNum, argv + iParsedNum, sSvcParam) != 0) {
printf ("parse pCommand line failed\n");
+ fclose(pFpSrc);
return 1;
}
if (cmResultSuccess != pPtrEnc->Initialize (&sSvcParam, INIT_TYPE_PARAMETER_BASED)) {
fprintf (stderr, "Encoder Initialization failed!\n");
+ fclose(pFpSrc);
return 1;
}
Best regards
Martin Ettl
+1
Also, fclose(pFpBs)
Even though the files are automatically closed when the program exits, as is the case above, it is good to explicitly do so.
I put this into pull request #58 along with the other two patches you submitted. You will get a faster response from more contributors if you issue pull requests yourself for these, but we are happy to have your contributions either way. Thanks.