[vlc-commits] npolibvlc: fix more leaks

Felix Paul Kühne git at videolan.org
Mon Feb 17 19:12:51 CET 2014


npapi-vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Mon Feb 17 19:12:55 2014 +0100| [7d83dfc67a3200218b08c11b57f9c48ce476e579] | committer: Felix Paul Kühne

npolibvlc: fix more leaks

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=7d83dfc67a3200218b08c11b57f9c48ce476e579
---

 npapi/control/npolibvlc.cpp |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/npapi/control/npolibvlc.cpp b/npapi/control/npolibvlc.cpp
index 533d2c6..a930f9e 100644
--- a/npapi/control/npolibvlc.cpp
+++ b/npapi/control/npolibvlc.cpp
@@ -410,12 +410,16 @@ LibvlcAudioNPObject::invoke(int index, const NPVariant *args,
                      * and get the track number */
                     if( isNumberValue(args[0]) )
                         i_trackID = numberValue(args[0]);
-                    else
+                    else {
+                        libvlc_track_description_list_release(p_trackDesc);
                         return INVOKERESULT_INVALID_VALUE;
+                    }
 
                     /* if bad number is given return invalid value */
-                    if (i_trackID < 0)
+                    if (i_trackID < 0) {
+                        libvlc_track_description_list_release(p_trackDesc);
                         return INVOKERESULT_INVALID_VALUE;
+                    }
 
                     /* get the good trackDesc */
                     for (i = 0; i < i_limit; i++)
@@ -1347,12 +1351,16 @@ LibvlcSubtitleNPObject::invoke(int index, const NPVariant *args,
                      * and get the subtitle number */
                     if( isNumberValue(args[0]) )
                         i_spuID = numberValue(args[0]);
-                    else
+                    else {
+                        libvlc_track_description_list_release(p_spuDesc);
                         return INVOKERESULT_INVALID_VALUE;
+                    }
 
                     /* if bad number is given return invalid value */
-                    if (i_spuID < 0)
+                    if (i_spuID < 0) {
+                        libvlc_track_description_list_release(p_spuDesc);
                         return INVOKERESULT_INVALID_VALUE;
+                    }
 
                     /* get the good spuDesc */
                     for (i = 0; i < i_limit; i++)



More information about the vlc-commits mailing list