[vlc-commits] [Git][videolan/vlc][master] 14 commits: tcp: fix socks leak

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Jan 12 07:08:56 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
71de94b1 by Johannes Kauffmann at 2024-01-12T06:45:52+00:00
tcp: fix socks leak

socks needs to be freed after the last usage of realhost, since socks
is assigned to realhost.

Also correct the comment.

- - - - -
59bb141c by Johannes Kauffmann at 2024-01-12T06:45:52+00:00
meta/folder: fix filename leak

Fixes: 9215854f0f49b072b313312d87d575997197dafb

- - - - -
b945194f by Johannes Kauffmann at 2024-01-12T06:45:52+00:00
access/dtv: fix mod leak

- - - - -
c3c9840b by Johannes Kauffmann at 2024-01-12T06:45:52+00:00
aout: file: remove free(NULL)

There used to be a test for a NULL char as well, but it was removed in
b1c459e9502282ad3bc94016e532a372f9c6955c.

- - - - -
02d87cc9 by Johannes Kauffmann at 2024-01-12T06:45:52+00:00
aout: file: fix psz_name leak

- - - - -
5b79e0f9 by Johannes Kauffmann at 2024-01-12T06:45:52+00:00
cli: fix psz_unix_path leak

- - - - -
fee2c799 by Johannes Kauffmann at 2024-01-12T06:45:52+00:00
opengl: sampler: fix lut_file leak

Fixes: 934e23b6101bbeceed8ee23a7fb751df2e1e3533

- - - - -
4091808f by Johannes Kauffmann at 2024-01-12T06:45:52+00:00
mmal: vout: fix display_name leak

Fixes: 8d21584f61daa145b2a70089cce580dc20a09cfa

- - - - -
ca51bd21 by Johannes Kauffmann at 2024-01-12T06:45:52+00:00
dxva2_deinterlace: fix psz_mode leak

- - - - -
1ced6b10 by Johannes Kauffmann at 2024-01-12T06:45:52+00:00
d3d11_deinterlace: fix psz_mode leak

- - - - -
56837c1a by Johannes Kauffmann at 2024-01-12T06:45:52+00:00
ntservice: fix psz_service leak

- - - - -
3d5f48fa by Johannes Kauffmann at 2024-01-12T06:45:52+00:00
libaribcaption: fix psz_cfg_font_name leak

Fixes: d7082e8ba7ac1b20c3b0851d78c12dfff6caca47

- - - - -
24163ce0 by Johannes Kauffmann at 2024-01-12T06:45:52+00:00
opencv_wrapper: fix psz_inner_name leak

- - - - -
96868032 by Johannes Kauffmann at 2024-01-12T06:45:52+00:00
cdda: don't check for !*psz_mbserver

The current code looks like it leaks. It doesn't, because checking for
!*psz_mbserver (and free()ing it) is done for us by var_InheritString.

- - - - -


13 changed files:

- modules/access/cdda.c
- modules/access/dtv/access.c
- modules/audio_output/file.c
- modules/codec/arib/libaribcaption.c
- modules/control/cli/cli.c
- modules/control/ntservice.c
- modules/hw/d3d11/d3d11_deinterlace.c
- modules/hw/d3d9/dxva2_deinterlace.c
- modules/hw/mmal/vout.c
- modules/meta_engine/folder.c
- modules/video_filter/opencv_wrapper.c
- modules/video_output/opengl/sampler.c
- src/network/tcp.c


Changes:

=====================================
modules/access/cdda.c
=====================================
@@ -476,7 +476,7 @@ static musicbrainz_recording_t * GetMusicbrainzInfo( vlc_object_t *obj,
     musicbrainz_recording_t *recording = NULL;
 
     char *psz_mbserver = var_InheritString( obj, "musicbrainz-server" );
-    if( !psz_mbserver || !*psz_mbserver )
+    if( !psz_mbserver )
         return NULL;
 
     musicbrainz_config_t cfg = { .obj = obj,


=====================================
modules/access/dtv/access.c
=====================================
@@ -686,7 +686,9 @@ static const char *var_InheritModulation (vlc_object_t *obj, const char *var)
         case 64:  str = "64QAM";  break;
         case 128: str = "128QAM"; break;
         case 256: str = "256QAM"; break;
-        default:  return "";
+        default:
+            free (mod);
+            return "";
     }
 
     msg_Warn (obj, "\"modulation=%s\" option is obsolete. "


=====================================
modules/audio_output/file.c
=====================================
@@ -139,14 +139,16 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
     if( !psz_name )
     {
         msg_Err( p_aout, "you need to specify an output file name" );
-        free( psz_name );
         return VLC_EGENERIC;
     }
 
     /* Allocate structure */
     aout_sys_t *p_sys = malloc( sizeof( aout_sys_t ) );
     if( p_sys == NULL )
+    {
+        free( psz_name );
         return VLC_ENOMEM;
+    }
     p_aout->sys = p_sys;
 
     if( !strcmp( psz_name, "-" ) )


=====================================
modules/codec/arib/libaribcaption.c
=====================================
@@ -89,6 +89,7 @@ static void DecSysRelease(decoder_sys_t *p_sys)
         aribcc_decoder_free(p_sys->p_decoder);
     if (p_sys->p_context)
         aribcc_context_free(p_sys->p_context);
+    free(p_sys->psz_cfg_font_name);
 
     free(p_sys);
 }


=====================================
modules/control/cli/cli.c
=====================================
@@ -878,6 +878,7 @@ static int Activate( vlc_object_t *p_this )
         if (len >= sizeof (addr.sun_path))
         {
             msg_Err( p_intf, "rc-unix value is longer than expected" );
+            free(psz_unix_path);
             goto error;
         }
         memcpy(addr.sun_path, psz_unix_path, len + 1);


=====================================
modules/control/ntservice.c
=====================================
@@ -155,12 +155,14 @@ static void *Run( void *data )
     if( var_InheritBool( p_intf, "ntservice-install" ) )
     {
         NTServiceInstall( p_intf );
+        free( p_intf->p_sys->psz_service );
         return NULL;
     }
 
     if( var_InheritBool( p_intf, "ntservice-uninstall" ) )
     {
         NTServiceUninstall( p_intf );
+        free( p_intf->p_sys->psz_service );
         return NULL;
     }
 


=====================================
modules/hw/d3d11/d3d11_deinterlace.c
=====================================
@@ -292,6 +292,7 @@ int D3D11OpenDeinterlace(filter_t *filter)
     }
     if (psz_mode == NULL || strcmp(p_mode->psz_mode, psz_mode))
         msg_Dbg(filter, "using %s deinterlacing mode", p_mode->psz_mode);
+    free(psz_mode);
 
     D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS rateCaps;
     for (UINT type = 0; type < processorCaps.RateConversionCapsCount; ++type)


=====================================
modules/hw/d3d9/dxva2_deinterlace.c
=====================================
@@ -415,6 +415,7 @@ int D3D9OpenDeinterlace(filter_t *filter)
     }
     if (psz_mode == NULL || strcmp(p_mode->psz_mode, psz_mode))
         msg_Dbg(filter, "using %s deinterlacing mode", p_mode->psz_mode);
+    free(psz_mode);
 
     DXVA2_VideoProcessorCaps caps, best_caps;
     unsigned best_score = 0;


=====================================
modules/hw/mmal/vout.c
=====================================
@@ -1135,6 +1135,7 @@ static int OpenMmalVout(vout_display_t *vd,
         else
             msg_Dbg(vd, "Display device: %s, qt=%d id=%d display=%d", display_name,
                     qt_num, display_id, sys->display_id);
+        free(display_name);
     }
 
     status = mmal_component_create(MMAL_COMPONENT_DEFAULT_VIDEO_RENDERER, &sys->component);


=====================================
modules/meta_engine/folder.c
=====================================
@@ -140,6 +140,7 @@ static int FindMeta( vlc_object_t *p_this )
             }
     }
 
+    free(filename);
     free(psz_basedir);
     return ret;
 }


=====================================
modules/video_filter/opencv_wrapper.c
=====================================
@@ -265,6 +265,8 @@ static void Destroy( filter_t* p_filter )
     filter_sys_t *p_sys = p_filter->p_sys;
     ReleaseImages( p_filter );
 
+    free( p_sys->psz_inner_name );
+
     // Release the internal OpenCV filter.
     filter_Close( p_sys->p_opencv );
     module_unneed( p_sys->p_opencv, p_sys->p_opencv->p_module );


=====================================
modules/video_output/opengl/sampler.c
=====================================
@@ -775,6 +775,7 @@ opengl_fragment_shader_init(struct vlc_gl_sampler *sampler, bool expose_planes)
 
         char *lut_file = var_InheritString(priv->gl, "gl-lut-file");
         struct pl_custom_lut *lut = LoadCustomLUT(sampler, lut_file);
+        free(lut_file);
         if (lut) {
             // Transform from the video input to the LUT input color space,
             // defaulting to a no-op if LUT input color space info is unknown


=====================================
src/network/tcp.c
=====================================
@@ -274,10 +274,11 @@ int (net_ConnectTCP)(vlc_object_t *obj, const char *host, int serv)
     }
 
     int fd = net_Connect(obj, realhost, realserv, SOCK_STREAM, IPPROTO_TCP);
+    free(socks);
 
     if (socks != NULL && fd != -1)
     {
-        /* NOTE: psz_socks already free'd! */
+        /* NOTE: socks already free'd! */
         char *user = var_InheritString(obj, "socks-user");
         char *pwd = var_InheritString(obj, "socks-pwd");
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/50d9155ade4fb40e8533dadb81a8f9d9a0d54394...968680321dcccefb375f3ccf0194c2a43251a2b3

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/50d9155ade4fb40e8533dadb81a8f9d9a0d54394...968680321dcccefb375f3ccf0194c2a43251a2b3
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list