From fe3c4810e1c8b535caf07df8e4434e322d3e6fc0 Mon Sep 17 00:00:00 2001 From: cboesch Date: Sun, 14 Nov 2010 09:12:34 +0000 Subject: cleanup: remove NULL checks before free() all over the code git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32624 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/freesdp/parser.c | 6 ++---- stream/librtsp/rtsp.c | 6 +++--- stream/librtsp/rtsp_rtp.c | 3 +-- stream/librtsp/rtsp_session.c | 10 +++++----- stream/realrtsp/real.c | 3 +-- stream/realrtsp/rmff.c | 6 +++--- stream/realrtsp/sdpplin.c | 24 ++++++++---------------- 7 files changed, 23 insertions(+), 35 deletions(-) (limited to 'stream') diff --git a/stream/freesdp/parser.c b/stream/freesdp/parser.c index 6d806a6e80..0774ce84f8 100644 --- a/stream/freesdp/parser.c +++ b/stream/freesdp/parser.c @@ -471,8 +471,7 @@ fsdp_parse (const char *text_description, fsdp_description_t * dsc) } else if (!strncmp (fsdp_buf[0], "range", 5)) { - if (dsc->a_range) - free (dsc->a_range); + free (dsc->a_range); dsc->a_range = strdup (fsdp_buf[1]); } else @@ -770,8 +769,7 @@ fsdp_parse (const char *text_description, fsdp_description_t * dsc) } else if (!strncmp (fsdp_buf[0], "range", 5)) { - if (media->a_range) - free (media->a_range); + free (media->a_range); media->a_range = strdup (fsdp_buf[1]); } else if (!strncmp (fsdp_buf[0], "framerate", 9)) diff --git a/stream/librtsp/rtsp.c b/stream/librtsp/rtsp.c index 82669616ac..e02ae4c72b 100644 --- a/stream/librtsp/rtsp.c +++ b/stream/librtsp/rtsp.c @@ -291,7 +291,7 @@ static int rtsp_get_answers(rtsp_t *s) { if (!strncasecmp(answer,"Server:",7)) { char *buf = malloc(strlen(answer)); sscanf(answer,"%*s %s",buf); - if (s->server) free(s->server); + free(s->server); s->server=strdup(buf); free(buf); } @@ -612,7 +612,7 @@ char *rtsp_search_answers(rtsp_t *s, const char *tag) { void rtsp_set_session(rtsp_t *s, const char *id) { - if (s->session) free(s->session); + free(s->session); s->session=strdup(id); @@ -686,7 +686,7 @@ void rtsp_unschedule_field(rtsp_t *s, const char *string) { else ptr++; } - if (*ptr) free(*ptr); + free(*ptr); ptr++; do { *(ptr-1)=*ptr; diff --git a/stream/librtsp/rtsp_rtp.c b/stream/librtsp/rtsp_rtp.c index b0c36a9eeb..ca82209252 100644 --- a/stream/librtsp/rtsp_rtp.c +++ b/stream/librtsp/rtsp_rtp.c @@ -131,8 +131,7 @@ rtp_session_free (struct rtp_rtsp_session_t *st) if (st->rtcp_socket != -1) close (st->rtcp_socket); - if (st->control_url) - free (st->control_url); + free (st->control_url); free (st); } diff --git a/stream/librtsp/rtsp_session.c b/stream/librtsp/rtsp_session.c index b1176dbb99..625727288c 100644 --- a/stream/librtsp/rtsp_session.c +++ b/stream/librtsp/rtsp_session.c @@ -89,11 +89,11 @@ static void rtsp_close(rtsp_t *s) { closesocket (s->s); } - if (s->path) free(s->path); - if (s->host) free(s->host); - if (s->mrl) free(s->mrl); - if (s->session) free(s->session); - if (s->user_agent) free(s->user_agent); + free(s->path); + free(s->host); + free(s->mrl); + free(s->session); + free(s->user_agent); free(s->server); rtsp_free_answers(s); rtsp_unschedule_all(s); diff --git a/stream/realrtsp/real.c b/stream/realrtsp/real.c index cad231dedd..6f33bc9c6c 100644 --- a/stream/realrtsp/real.c +++ b/stream/realrtsp/real.c @@ -507,8 +507,7 @@ rtsp_send_describe: } autherr: - if (authfield) - free(authfield); + free(authfield); if ( status<200 || status>299 ) { diff --git a/stream/realrtsp/rmff.c b/stream/realrtsp/rmff.c index e147b76f36..d538222141 100644 --- a/stream/realrtsp/rmff.c +++ b/stream/realrtsp/rmff.c @@ -847,9 +847,9 @@ void rmff_free_header(rmff_header_t *h) { if (!h) return; - if (h->fileheader) free(h->fileheader); - if (h->prop) free(h->prop); - if (h->data) free(h->data); + free(h->fileheader); + free(h->prop); + free(h->data); if (h->cont) { free(h->cont->title); diff --git a/stream/realrtsp/sdpplin.c b/stream/realrtsp/sdpplin.c index fe561f4082..41ef618d25 100644 --- a/stream/realrtsp/sdpplin.c +++ b/stream/realrtsp/sdpplin.c @@ -368,14 +368,10 @@ void sdpplin_free(sdpplin_t *description) { for (i = 0; i < description->stream_count; i++) { if (description->stream[i]) { - if (description->stream[i]->stream_name) - free(description->stream[i]->stream_name); - if (description->stream[i]->mime_type) - free(description->stream[i]->mime_type); - if (description->stream[i]->mlti_data) - free(description->stream[i]->mlti_data); - if (description->stream[i]->asm_rule_book) - free(description->stream[i]->asm_rule_book); + free(description->stream[i]->stream_name); + free(description->stream[i]->mime_type); + free(description->stream[i]->mlti_data); + free(description->stream[i]->asm_rule_book); free(description->stream[i]->id); free(description->stream[i]); } @@ -383,14 +379,10 @@ void sdpplin_free(sdpplin_t *description) { if(description->stream_count) free(description->stream); - if (description->title) - free(description->title); - if (description->author) - free(description->author); - if (description->copyright) - free(description->copyright); - if (description->abstract) - free(description->abstract); + free(description->title); + free(description->author); + free(description->copyright); + free(description->abstract); free(description); } -- cgit v1.2.3