From: Mauro Carvalho Chehab Date: Thu, 28 Nov 2013 11:58:05 +0000 (-0200) Subject: libdvbv5: Fix other error conditions for out of memory X-Git-Tag: v4l-utils-1.2.0~278 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=16a6e0493ab26d1d90afd181f6eaa6eadb37aa72;p=platform%2Fupstream%2Fv4l-utils.git libdvbv5: Fix other error conditions for out of memory As Coverity points, there are other places where this error also occurs. Fix all of them. Signed-off-by: Mauro Carvalho Chehab --- diff --git a/lib/libdvbv5/descriptors/desc_logical_channel.c b/lib/libdvbv5/descriptors/desc_logical_channel.c index 3f18c69..5eb5855 100644 --- a/lib/libdvbv5/descriptors/desc_logical_channel.c +++ b/lib/libdvbv5/descriptors/desc_logical_channel.c @@ -36,8 +36,10 @@ void dvb_desc_logical_channel_init(struct dvb_v5_fe_parms *parms, int i; d->lcn = malloc(d->length); - if (!d->lcn) + if (!d->lcn) { dvb_perror("Out of memory!"); + return; + } memcpy(d->lcn, p, d->length); diff --git a/lib/libdvbv5/descriptors/desc_partial_reception.c b/lib/libdvbv5/descriptors/desc_partial_reception.c index 41bf428..9471772 100644 --- a/lib/libdvbv5/descriptors/desc_partial_reception.c +++ b/lib/libdvbv5/descriptors/desc_partial_reception.c @@ -33,8 +33,10 @@ void isdb_desc_partial_reception_init(struct dvb_v5_fe_parms *parms, int i; d->partial_reception = malloc(d->length); - if (!d->partial_reception) + if (!d->partial_reception) { dvb_perror("Out of memory!"); + return; + } memcpy(d->partial_reception, p, d->length); diff --git a/lib/libdvbv5/descriptors/nit.c b/lib/libdvbv5/descriptors/nit.c index 97865d2..b1bbfab 100644 --- a/lib/libdvbv5/descriptors/nit.c +++ b/lib/libdvbv5/descriptors/nit.c @@ -93,8 +93,10 @@ void dvb_table_nit_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, ssize struct dvb_table_nit_transport *transport; transport = malloc(sizeof(struct dvb_table_nit_transport)); - if (!transport) + if (!transport) { dvb_perror("Out of memory"); + return; + } memcpy(transport, p, size); p += size; diff --git a/lib/libdvbv5/dvb-scan.c b/lib/libdvbv5/dvb-scan.c index 978975e..639e669 100644 --- a/lib/libdvbv5/dvb-scan.c +++ b/lib/libdvbv5/dvb-scan.c @@ -124,8 +124,11 @@ int dvb_read_section_with_id(struct dvb_v5_fe_parms *parms, int dmx_fd, dvb_log("Parsing table ID %d, program ID %d", tid, pid); buf = malloc(DVB_MAX_PAYLOAD_PACKET_SIZE); - if (!buf) + if (!buf) { dvb_perror("Out of memory"); + dvb_dmx_stop(dmx_fd); + return -1; + } while (1) { int available; ssize_t buf_length = 0;