Commit 0c2787f8 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Compile fixes and another memory leak fix

parent 966a1503
...@@ -250,7 +250,7 @@ void rmff_dump_pheader(rmff_pheader_t *h, char *data) { ...@@ -250,7 +250,7 @@ void rmff_dump_pheader(rmff_pheader_t *h, char *data) {
rmff_fileheader_t *rmff_new_fileheader(uint32_t num_headers) rmff_fileheader_t *rmff_new_fileheader(uint32_t num_headers)
{ {
rmff_fileheader_t *fileheader = malloc(sizeof(rmff_fileheader_t)); rmff_fileheader_t *fileheader = malloc(sizeof(rmff_fileheader_t));
if( !filehandler ) return NULL; if( !fileheader ) return NULL;
memset(fileheader, 0, sizeof(rmff_fileheader_t)); memset(fileheader, 0, sizeof(rmff_fileheader_t));
fileheader->object_id=RMF_TAG; fileheader->object_id=RMF_TAG;
...@@ -475,8 +475,8 @@ void rmff_print_header(rmff_header_t *h) ...@@ -475,8 +475,8 @@ void rmff_print_header(rmff_header_t *h)
void rmff_fix_header(rmff_header_t *h) void rmff_fix_header(rmff_header_t *h)
{ {
int num_headers=0; unsigned int num_headers=0;
int header_size=0; unsigned int header_size=0;
rmff_mdpr_t **streams; rmff_mdpr_t **streams;
int num_streams=0; int num_streams=0;
......
...@@ -32,7 +32,8 @@ ...@@ -32,7 +32,8 @@
static char *b64_decode(const char *in, char *out, int *size) static char *b64_decode(const char *in, char *out, int *size)
{ {
char dtable[256]; /* Encode / decode table */ char dtable[256]; /* Encode / decode table */
int i,j,k; int i,k;
unsigned int j;
for (i = 0; i < 255; i++) { for (i = 0; i < 255; i++) {
dtable[i] = 0x80; dtable[i] = 0x80;
...@@ -109,7 +110,6 @@ static int filter(const char *in, const char *filter, char **out) ...@@ -109,7 +110,6 @@ static int filter(const char *in, const char *filter, char **out)
(*out)[len-flen]=0; (*out)[len-flen]=0;
return len-flen; return len-flen;
} }
return 0; return 0;
} }
...@@ -120,9 +120,12 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) ...@@ -120,9 +120,12 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data)
char *decoded = malloc(32000); char *decoded = malloc(32000);
int handled; int handled;
if( !desc ) goto error; if( !desc ) return NULL;
memset(desc, 0, sizeof(sdpplin_stream_t)); memset(desc, 0, sizeof(sdpplin_stream_t));
if( !buf ) goto error;
if( !decoded ) goto error;
if (filter(*data, "m=", &buf)) if (filter(*data, "m=", &buf))
{ {
desc->id = strdup(buf); desc->id = strdup(buf);
...@@ -130,10 +133,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) ...@@ -130,10 +133,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data)
else else
{ {
lprintf("sdpplin: no m= found.\n"); lprintf("sdpplin: no m= found.\n");
if( decoded ) free(decoded); goto error;
if( desc ) free( desc );
if( buf ) free( buf );
return NULL;
} }
*data=nl(*data); *data=nl(*data);
...@@ -225,6 +225,12 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) ...@@ -225,6 +225,12 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data)
if( buf ) free(buf); if( buf ) free(buf);
if( decoded )free(decoded); if( decoded )free(decoded);
return desc; return desc;
error:
if( decoded ) free(decoded);
if( desc ) free( desc );
if( buf ) free( buf );
return NULL;
} }
sdpplin_t *sdpplin_parse(char *data) sdpplin_t *sdpplin_parse(char *data)
......
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