[MPlayer-cvslog] r37927 - in trunk: mpcommon.c path.c path.h
al
subversion at mplayerhq.hu
Mon Mar 13 22:42:19 EET 2017
Author: al
Date: Mon Mar 13 22:42:18 2017
New Revision: 37927
Log:
mpcommon: common_init: Avoid creating a mem leak of codec_path
The codec path is set by the config system anyway. Setting it again
and assuming the original value wasn't already duplicated by the
config system just creates a mem leak.
This change also simplifies the code because function set_codec_path
isn't needed anymore.
Fixes part of ticket 2311
Modified:
trunk/mpcommon.c
trunk/path.c
trunk/path.h
Modified: trunk/mpcommon.c
==============================================================================
--- trunk/mpcommon.c Sun Feb 26 19:32:59 2017 (r37926)
+++ trunk/mpcommon.c Mon Mar 13 22:42:18 2017 (r37927)
@@ -588,9 +588,6 @@ int common_init(void)
set_priority();
#endif
- if (codec_path)
- set_codec_path(codec_path);
-
/* Check codecs.conf. */
if (!codecs_file || !parse_codec_cfg(codecs_file)) {
char *conf_path = get_path("codecs.conf");
Modified: trunk/path.c
==============================================================================
--- trunk/path.c Sun Feb 26 19:32:59 2017 (r37926)
+++ trunk/path.c Mon Mar 13 22:42:18 2017 (r37927)
@@ -174,22 +174,6 @@ void set_path_env(void)
char *codec_path = BINARY_CODECS_PATH;
-static int needs_free = 0;
-
-void set_codec_path(const char *path)
-{
- if (needs_free)
- free(codec_path);
- if (path == 0) {
- codec_path = BINARY_CODECS_PATH;
- needs_free = 0;
- return;
- }
- codec_path = malloc(strlen(path) + 1);
- strcpy(codec_path, path);
- needs_free = 1;
-}
-
/**
* @brief Returns the basename substring of a path.
*/
Modified: trunk/path.h
==============================================================================
--- trunk/path.h Sun Feb 26 19:32:59 2017 (r37926)
+++ trunk/path.h Mon Mar 13 22:42:18 2017 (r37927)
@@ -25,7 +25,6 @@ extern char *codec_path;
char *get_path(const char *filename);
void set_path_env(void);
-void set_codec_path(const char *path);
const char *mp_basename(const char *path);
char *mp_dirname(const char *path);
char *mp_path_join(const char *base, const char *new_path);
More information about the MPlayer-cvslog
mailing list