Commit d3186edb authored by Timothy B. Terriberry's avatar 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
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment