Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
a45922cd
Commit
a45922cd
authored
Jan 25, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use g_free() instead of free()
On some platforms, g_free() must be used for memory allocated by GLib. This patch intends to correct a lot of occurrences, but is probably not complete.
parent
7960ad32
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
36 additions
and
40 deletions
+36
-40
audio.c
src/audio.c
+1
-1
client.c
src/client.c
+3
-3
database.c
src/database.c
+1
-1
dbUtils.c
src/dbUtils.c
+1
-1
mikmod_plugin.c
src/decoder/mikmod_plugin.c
+1
-1
mp4_plugin.c
src/decoder/mp4_plugin.c
+2
-2
directory.c
src/directory.c
+2
-2
locate.c
src/locate.c
+3
-3
alsa_plugin.c
src/output/alsa_plugin.c
+1
-1
ao_plugin.c
src/output/ao_plugin.c
+1
-1
jack_plugin.c
src/output/jack_plugin.c
+4
-4
mvp_plugin.c
src/output/mvp_plugin.c
+1
-1
oss_plugin.c
src/output/oss_plugin.c
+1
-1
osx_plugin.c
src/output/osx_plugin.c
+2
-3
shout_plugin.c
src/output/shout_plugin.c
+1
-1
strset.c
src/strset.c
+2
-2
tag.c
src/tag.c
+6
-8
update.c
src/update.c
+3
-4
No files found.
src/audio.c
View file @
a45922cd
...
@@ -183,7 +183,7 @@ void finishAudioDriver(void)
...
@@ -183,7 +183,7 @@ void finishAudioDriver(void)
audio_output_finish
(
&
audioOutputArray
[
i
]);
audio_output_finish
(
&
audioOutputArray
[
i
]);
}
}
free
(
audioOutputArray
);
g_
free
(
audioOutputArray
);
audioOutputArray
=
NULL
;
audioOutputArray
=
NULL
;
audioOutputArraySize
=
0
;
audioOutputArraySize
=
0
;
...
...
src/client.c
View file @
a45922cd
...
@@ -240,7 +240,7 @@ static void client_close(struct client *client)
...
@@ -240,7 +240,7 @@ static void client_close(struct client *client)
g_log
(
G_LOG_DOMAIN
,
LOG_LEVEL_SECURE
,
g_log
(
G_LOG_DOMAIN
,
LOG_LEVEL_SECURE
,
"client %i: closed"
,
client
->
num
);
"client %i: closed"
,
client
->
num
);
free
(
client
);
g_
free
(
client
);
}
}
static
const
char
*
static
const
char
*
...
@@ -637,7 +637,7 @@ static void client_write_deferred(struct client *client)
...
@@ -637,7 +637,7 @@ static void client_write_deferred(struct client *client)
assert
(
client
->
deferred_bytes
>=
decr
);
assert
(
client
->
deferred_bytes
>=
decr
);
client
->
deferred_bytes
-=
decr
;
client
->
deferred_bytes
-=
decr
;
free
(
buf
);
g_
free
(
buf
);
g_queue_pop_head
(
client
->
deferred_send
);
g_queue_pop_head
(
client
->
deferred_send
);
}
}
client
->
lastTime
=
time
(
NULL
);
client
->
lastTime
=
time
(
NULL
);
...
@@ -778,7 +778,7 @@ void client_vprintf(struct client *client, const char *fmt, va_list args)
...
@@ -778,7 +778,7 @@ void client_vprintf(struct client *client, const char *fmt, va_list args)
buffer
=
g_malloc
(
length
+
1
);
buffer
=
g_malloc
(
length
+
1
);
vsnprintf
(
buffer
,
length
+
1
,
fmt
,
args
);
vsnprintf
(
buffer
,
length
+
1
,
fmt
,
args
);
client_write
(
client
,
buffer
,
length
);
client_write
(
client
,
buffer
,
length
);
free
(
buffer
);
g_
free
(
buffer
);
}
}
G_GNUC_PRINTF
(
2
,
3
)
void
client_printf
(
struct
client
*
client
,
const
char
*
fmt
,
...)
G_GNUC_PRINTF
(
2
,
3
)
void
client_printf
(
struct
client
*
client
,
const
char
*
fmt
,
...)
...
...
src/database.c
View file @
a45922cd
...
@@ -125,7 +125,7 @@ db_get_song(const char *file)
...
@@ -125,7 +125,7 @@ db_get_song(const char *file)
assert
(
song
->
parent
==
directory
);
assert
(
song
->
parent
==
directory
);
out:
out:
free
(
duplicated
);
g_
free
(
duplicated
);
return
song
;
return
song
;
}
}
...
...
src/dbUtils.c
View file @
a45922cd
...
@@ -226,7 +226,7 @@ newListCommandItem(int tagType, const struct locate_item_list *criteria)
...
@@ -226,7 +226,7 @@ newListCommandItem(int tagType, const struct locate_item_list *criteria)
static
void
freeListCommandItem
(
ListCommandItem
*
item
)
static
void
freeListCommandItem
(
ListCommandItem
*
item
)
{
{
free
(
item
);
g_
free
(
item
);
}
}
static
void
static
void
...
...
src/decoder/mikmod_plugin.c
View file @
a45922cd
...
@@ -152,7 +152,7 @@ static void mod_close(mod_Data * data)
...
@@ -152,7 +152,7 @@ static void mod_close(mod_Data * data)
{
{
Player_Stop
();
Player_Stop
();
Player_Free
(
data
->
moduleHandle
);
Player_Free
(
data
->
moduleHandle
);
free
(
data
);
g_
free
(
data
);
}
}
static
void
static
void
...
...
src/decoder/mp4_plugin.c
View file @
a45922cd
...
@@ -179,7 +179,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *input_stream)
...
@@ -179,7 +179,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *input_stream)
file_time
=
mp4ff_get_track_duration_use_offsets
(
mp4fh
,
track
);
file_time
=
mp4ff_get_track_duration_use_offsets
(
mp4fh
,
track
);
scale
=
mp4ff_time_scale
(
mp4fh
,
track
);
scale
=
mp4ff_time_scale
(
mp4fh
,
track
);
g_
free
(
mp4_buffer
);
free
(
mp4_buffer
);
if
(
scale
<
0
)
{
if
(
scale
<
0
)
{
g_warning
(
"Error getting audio format of mp4 AAC track.
\n
"
);
g_warning
(
"Error getting audio format of mp4 AAC track.
\n
"
);
...
@@ -314,7 +314,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *input_stream)
...
@@ -314,7 +314,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *input_stream)
file_time
,
bit_rate
,
NULL
);
file_time
,
bit_rate
,
NULL
);
}
}
free
(
seek_table
);
g_
free
(
seek_table
);
faacDecClose
(
decoder
);
faacDecClose
(
decoder
);
mp4ff_close
(
mp4fh
);
mp4ff_close
(
mp4fh
);
}
}
...
...
src/directory.c
View file @
a45922cd
...
@@ -54,7 +54,7 @@ directory_free(struct directory *directory)
...
@@ -54,7 +54,7 @@ directory_free(struct directory *directory)
dirvec_destroy
(
&
directory
->
children
);
dirvec_destroy
(
&
directory
->
children
);
songvec_destroy
(
&
directory
->
songs
);
songvec_destroy
(
&
directory
->
songs
);
free
(
directory
);
g_
free
(
directory
);
/* this resets last dir returned */
/* this resets last dir returned */
/*directory_get_path(NULL); */
/*directory_get_path(NULL); */
}
}
...
@@ -108,7 +108,7 @@ directory_get_directory(struct directory *directory, const char *name)
...
@@ -108,7 +108,7 @@ directory_get_directory(struct directory *directory, const char *name)
locate
=
strchr
(
locate
+
1
,
'/'
);
locate
=
strchr
(
locate
+
1
,
'/'
);
}
}
free
(
duplicated
);
g_
free
(
duplicated
);
return
found
;
return
found
;
}
}
...
...
src/locate.c
View file @
a45922cd
...
@@ -68,7 +68,7 @@ locate_item_new(const char *type_string, const char *needle)
...
@@ -68,7 +68,7 @@ locate_item_new(const char *type_string, const char *needle)
struct
locate_item
*
ret
=
g_new
(
struct
locate_item
,
1
);
struct
locate_item
*
ret
=
g_new
(
struct
locate_item
,
1
);
if
(
!
locate_item_init
(
ret
,
type_string
,
needle
))
{
if
(
!
locate_item_init
(
ret
,
type_string
,
needle
))
{
free
(
ret
);
g_
free
(
ret
);
ret
=
NULL
;
ret
=
NULL
;
}
}
...
@@ -134,8 +134,8 @@ locate_item_list_casefold(const struct locate_item_list *list)
...
@@ -134,8 +134,8 @@ locate_item_list_casefold(const struct locate_item_list *list)
void
void
locate_item_free
(
struct
locate_item
*
item
)
locate_item_free
(
struct
locate_item
*
item
)
{
{
free
(
item
->
needle
);
g_
free
(
item
->
needle
);
free
(
item
);
g_
free
(
item
);
}
}
static
bool
static
bool
...
...
src/output/alsa_plugin.c
View file @
a45922cd
...
@@ -97,7 +97,7 @@ alsa_data_free(struct alsa_data *ad)
...
@@ -97,7 +97,7 @@ alsa_data_free(struct alsa_data *ad)
{
{
g_free
(
ad
->
device
);
g_free
(
ad
->
device
);
mixer_free
(
ad
->
mixer
);
mixer_free
(
ad
->
mixer
);
free
(
ad
);
g_
free
(
ad
);
}
}
static
void
static
void
...
...
src/output/ao_plugin.c
View file @
a45922cd
...
@@ -131,7 +131,7 @@ audioOutputAo_initDriver(struct audio_output *ao,
...
@@ -131,7 +131,7 @@ audioOutputAo_initDriver(struct audio_output *ao,
static
void
freeAoData
(
AoData
*
ad
)
static
void
freeAoData
(
AoData
*
ad
)
{
{
ao_free_options
(
ad
->
options
);
ao_free_options
(
ad
->
options
);
free
(
ad
);
g_
free
(
ad
);
}
}
static
void
audioOutputAo_finishDriver
(
void
*
data
)
static
void
audioOutputAo_finishDriver
(
void
*
data
)
...
...
src/output/jack_plugin.c
View file @
a45922cd
...
@@ -92,7 +92,7 @@ mpd_jack_free(struct jack_data *jd)
...
@@ -92,7 +92,7 @@ mpd_jack_free(struct jack_data *jd)
for
(
unsigned
i
=
0
;
i
<
G_N_ELEMENTS
(
jd
->
output_ports
);
++
i
)
for
(
unsigned
i
=
0
;
i
<
G_N_ELEMENTS
(
jd
->
output_ports
);
++
i
)
g_free
(
jd
->
output_ports
[
i
]);
g_free
(
jd
->
output_ports
[
i
]);
free
(
jd
);
g_
free
(
jd
);
}
}
static
void
static
void
...
@@ -275,7 +275,7 @@ mpd_jack_connect(struct jack_data *jd, struct audio_format *audio_format)
...
@@ -275,7 +275,7 @@ mpd_jack_connect(struct jack_data *jd, struct audio_format *audio_format)
jd
->
output_ports
[
0
]))
!=
0
)
{
jd
->
output_ports
[
0
]))
!=
0
)
{
g_warning
(
"%s is not a valid Jack Client / Port"
,
g_warning
(
"%s is not a valid Jack Client / Port"
,
jd
->
output_ports
[
0
]);
jd
->
output_ports
[
0
]);
free
(
port_name
);
g_
free
(
port_name
);
return
-
1
;
return
-
1
;
}
}
sprintf
(
port_name
,
"%s:right"
,
name
);
sprintf
(
port_name
,
"%s:right"
,
name
);
...
@@ -283,10 +283,10 @@ mpd_jack_connect(struct jack_data *jd, struct audio_format *audio_format)
...
@@ -283,10 +283,10 @@ mpd_jack_connect(struct jack_data *jd, struct audio_format *audio_format)
jd
->
output_ports
[
1
]))
!=
0
)
{
jd
->
output_ports
[
1
]))
!=
0
)
{
g_warning
(
"%s is not a valid Jack Client / Port"
,
g_warning
(
"%s is not a valid Jack Client / Port"
,
jd
->
output_ports
[
1
]);
jd
->
output_ports
[
1
]);
free
(
port_name
);
g_
free
(
port_name
);
return
-
1
;
return
-
1
;
}
}
free
(
port_name
);
g_
free
(
port_name
);
}
}
return
1
;
return
1
;
...
...
src/output/mvp_plugin.c
View file @
a45922cd
...
@@ -124,7 +124,7 @@ static void *mvp_initDriver(G_GNUC_UNUSED struct audio_output *audio_output,
...
@@ -124,7 +124,7 @@ static void *mvp_initDriver(G_GNUC_UNUSED struct audio_output *audio_output,
static
void
mvp_finishDriver
(
void
*
data
)
static
void
mvp_finishDriver
(
void
*
data
)
{
{
MvpData
*
md
=
data
;
MvpData
*
md
=
data
;
free
(
md
);
g_
free
(
md
);
}
}
static
int
mvp_setPcmParams
(
MvpData
*
md
,
unsigned
long
rate
,
int
channels
,
static
int
mvp_setPcmParams
(
MvpData
*
md
,
unsigned
long
rate
,
int
channels
,
...
...
src/output/oss_plugin.c
View file @
a45922cd
...
@@ -292,7 +292,7 @@ static void freeOssData(OssData * od)
...
@@ -292,7 +292,7 @@ static void freeOssData(OssData * od)
mixer_free
(
od
->
mixer
);
mixer_free
(
od
->
mixer
);
free
(
od
);
g_
free
(
od
);
}
}
#define OSS_STAT_NO_ERROR 0
#define OSS_STAT_NO_ERROR 0
...
...
src/output/osx_plugin.c
View file @
a45922cd
...
@@ -90,11 +90,10 @@ osx_initDriver(G_GNUC_UNUSED struct audio_output *audioOutput,
...
@@ -90,11 +90,10 @@ osx_initDriver(G_GNUC_UNUSED struct audio_output *audioOutput,
static
void
freeOsxData
(
OsxData
*
od
)
static
void
freeOsxData
(
OsxData
*
od
)
{
{
if
(
od
->
buffer
)
g_free
(
od
->
buffer
);
free
(
od
->
buffer
);
g_mutex_free
(
od
->
mutex
);
g_mutex_free
(
od
->
mutex
);
g_cond_free
(
od
->
condition
);
g_cond_free
(
od
->
condition
);
free
(
od
);
g_
free
(
od
);
}
}
static
void
osx_finishDriver
(
void
*
data
)
static
void
osx_finishDriver
(
void
*
data
)
...
...
src/output/shout_plugin.c
View file @
a45922cd
...
@@ -81,7 +81,7 @@ static void free_shout_data(struct shout_data *sd)
...
@@ -81,7 +81,7 @@ static void free_shout_data(struct shout_data *sd)
if
(
sd
->
timer
)
if
(
sd
->
timer
)
timer_free
(
sd
->
timer
);
timer_free
(
sd
->
timer
);
free
(
sd
);
g_
free
(
sd
);
}
}
#define check_block_param(name) { \
#define check_block_param(name) { \
...
...
src/strset.c
View file @
a45922cd
...
@@ -64,12 +64,12 @@ void strset_free(struct strset *set)
...
@@ -64,12 +64,12 @@ void strset_free(struct strset *set)
while
(
slot
!=
NULL
)
{
while
(
slot
!=
NULL
)
{
next
=
slot
->
next
;
next
=
slot
->
next
;
free
(
slot
);
g_
free
(
slot
);
slot
=
next
;
slot
=
next
;
}
}
}
}
free
(
set
);
g_
free
(
set
);
}
}
void
strset_add
(
struct
strset
*
set
,
const
char
*
value
)
void
strset_add
(
struct
strset
*
set
,
const
char
*
value
)
...
...
src/tag.c
View file @
a45922cd
...
@@ -115,7 +115,7 @@ void tag_lib_init(void)
...
@@ -115,7 +115,7 @@ void tag_lib_init(void)
s
++
;
s
++
;
}
}
free
(
temp
);
g_
free
(
temp
);
}
}
struct
tag
*
tag_ape_load
(
const
char
*
file
)
struct
tag
*
tag_ape_load
(
const
char
*
file
)
...
@@ -234,8 +234,7 @@ struct tag *tag_ape_load(const char *file)
...
@@ -234,8 +234,7 @@ struct tag *tag_ape_load(const char *file)
fail:
fail:
if
(
fp
)
if
(
fp
)
fclose
(
fp
);
fclose
(
fp
);
if
(
buffer
)
g_free
(
buffer
);
free
(
buffer
);
return
ret
;
return
ret
;
}
}
...
@@ -265,7 +264,7 @@ static void deleteItem(struct tag *tag, int idx)
...
@@ -265,7 +264,7 @@ static void deleteItem(struct tag *tag, int idx)
if
(
tag
->
numOfItems
>
0
)
{
if
(
tag
->
numOfItems
>
0
)
{
tag
->
items
=
g_realloc
(
tag
->
items
,
items_size
(
tag
));
tag
->
items
=
g_realloc
(
tag
->
items
,
items_size
(
tag
));
}
else
{
}
else
{
free
(
tag
->
items
);
g_
free
(
tag
->
items
);
tag
->
items
=
NULL
;
tag
->
items
=
NULL
;
}
}
}
}
...
@@ -297,11 +296,10 @@ void tag_free(struct tag *tag)
...
@@ -297,11 +296,10 @@ void tag_free(struct tag *tag)
assert
(
bulk
.
busy
);
assert
(
bulk
.
busy
);
bulk
.
busy
=
0
;
bulk
.
busy
=
0
;
#endif
#endif
}
else
if
(
tag
->
items
)
{
}
else
free
(
tag
->
items
);
g_free
(
tag
->
items
);
}
free
(
tag
);
g_
free
(
tag
);
}
}
struct
tag
*
tag_dup
(
const
struct
tag
*
tag
)
struct
tag
*
tag_dup
(
const
struct
tag
*
tag
)
...
...
src/update.c
View file @
a45922cd
...
@@ -618,7 +618,7 @@ addParentPathToDB(const char *utf8path)
...
@@ -618,7 +618,7 @@ addParentPathToDB(const char *utf8path)
*
slash
++
=
'/'
;
*
slash
++
=
'/'
;
}
}
free
(
duplicated
);
g_
free
(
duplicated
);
return
directory
;
return
directory
;
}
}
...
@@ -647,7 +647,7 @@ static void * update_task(void *_path)
...
@@ -647,7 +647,7 @@ static void * update_task(void *_path)
{
{
if
(
_path
!=
NULL
&&
!
isRootDirectory
(
_path
))
{
if
(
_path
!=
NULL
&&
!
isRootDirectory
(
_path
))
{
updatePath
((
char
*
)
_path
);
updatePath
((
char
*
)
_path
);
free
(
_path
);
g_
free
(
_path
);
}
else
{
}
else
{
struct
directory
*
directory
=
db_get_root
();
struct
directory
*
directory
=
db_get_root
();
struct
stat
st
;
struct
stat
st
;
...
@@ -691,8 +691,7 @@ directory_update_init(char *path)
...
@@ -691,8 +691,7 @@ directory_update_init(char *path)
unsigned
next_task_id
;
unsigned
next_task_id
;
if
(
update_paths_nr
==
G_N_ELEMENTS
(
update_paths
))
{
if
(
update_paths_nr
==
G_N_ELEMENTS
(
update_paths
))
{
if
(
path
)
g_free
(
path
);
free
(
path
);
return
0
;
return
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment