Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ralph Giles
Opusfile
Commits
d3186edb
Commit
d3186edb
authored
Jan 07, 2014
by
Timothy B. Terriberry
Browse files
Clean up some bare malloc/free calls.
These should use the same macros as the rest of the code.
parent
ba2e9b74
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/stream.c
View file @
d3186edb
...
...
@@ -141,7 +141,7 @@ static wchar_t *op_utf8_to_utf16(const char *_src){
size_t
len
;
len
=
strlen
(
_src
);
/*Worst-case output is 1 wide character per 1 input character.*/
dst
=
(
wchar_t
*
)
malloc
(
sizeof
(
*
dst
)
*
(
len
+
1
));
dst
=
(
wchar_t
*
)
_ogg_
malloc
(
sizeof
(
*
dst
)
*
(
len
+
1
));
if
(
dst
!=
NULL
){
size_t
si
;
size_t
di
;
...
...
@@ -218,7 +218,7 @@ static wchar_t *op_utf8_to_utf16(const char *_src){
}
}
/*If we got here, we encountered an illegal UTF-8 sequence.*/
free
(
dst
);
_ogg_
free
(
dst
);
return
NULL
;
}
OP_ASSERT
(
di
<=
len
);
...
...
@@ -244,8 +244,8 @@ void *op_fopen(OpusFileCallbacks *_cb,const char *_path,const char *_mode){
if
(
wmode
==
NULL
)
errno
=
EINVAL
;
else
if
(
wpath
==
NULL
)
errno
=
ENOENT
;
else
fp
=
_wfopen
(
wpath
,
wmode
);
free
(
wmode
);
free
(
wpath
);
_ogg_
free
(
wmode
);
_ogg_
free
(
wpath
);
}
#endif
if
(
fp
!=
NULL
)
*
_cb
=*&
OP_FILE_CALLBACKS
;
...
...
@@ -275,8 +275,8 @@ void *op_freopen(OpusFileCallbacks *_cb,const char *_path,const char *_mode,
if
(
wmode
==
NULL
)
errno
=
EINVAL
;
else
if
(
wpath
==
NULL
)
errno
=
ENOENT
;
else
fp
=
_wfreopen
(
wpath
,
wmode
,(
FILE
*
)
_stream
);
free
(
wmode
);
free
(
wpath
);
_ogg_
free
(
wmode
);
_ogg_
free
(
wpath
);
}
#endif
if
(
fp
!=
NULL
)
*
_cb
=*&
OP_FILE_CALLBACKS
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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