diff options
author | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-05-22 15:12:11 +0200 |
---|---|---|
committer | Jonathan Aillet <jonathan.aillet@iot.bzh> | 2019-05-24 16:31:22 +0200 |
commit | 06054f68c5d5ca216f2756e7de2787a7ea2b9488 (patch) | |
tree | 45332bf88713260528cd8807180d14c796dd0d68 /plugins/lib | |
parent | 701bea793ed1d2e20d036957268a71973c975cda (diff) |
Add forgotten verifications of allocation results
Concern several types of allocation such as :
- malloc/calloc
- json_object_new_*
- wrap_json_pack
- strdup
BUG-AGL: SPEC-2329
Change-Id: Iffe2a6a44ef4df2ed0ec4d159682159db5e78cfb
Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
Diffstat (limited to 'plugins/lib')
-rw-r--r-- | plugins/lib/bluealsa/hal-bluealsa-transports.c | 2 | ||||
-rw-r--r-- | plugins/lib/bluealsa/hal-bluealsa.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/plugins/lib/bluealsa/hal-bluealsa-transports.c b/plugins/lib/bluealsa/hal-bluealsa-transports.c index 341fb6b..8638b36 100644 --- a/plugins/lib/bluealsa/hal-bluealsa-transports.c +++ b/plugins/lib/bluealsa/hal-bluealsa-transports.c @@ -35,7 +35,7 @@ bluealsa_transport_t * halBlueAlsaTransportsAdd( const struct ba_msg_transport * transport) { bluealsa_transport_t * newTransport = (bluealsa_transport_t*) calloc(1, sizeof(bluealsa_transport_t)); - if (newTransport == NULL) + if (!newTransport) goto fail; memcpy(&newTransport->transport, transport, sizeof(struct ba_msg_transport)); diff --git a/plugins/lib/bluealsa/hal-bluealsa.c b/plugins/lib/bluealsa/hal-bluealsa.c index efce322..ca49bda 100644 --- a/plugins/lib/bluealsa/hal-bluealsa.c +++ b/plugins/lib/bluealsa/hal-bluealsa.c @@ -125,6 +125,9 @@ CTLP_CAPI(init, source, argsJ, queryJ) CtlPluginT * plugin = source->plugin; hal_bluealsa_plugin_data_t * pluginData = (hal_bluealsa_plugin_data_t*) calloc(1, sizeof(hal_bluealsa_plugin_data_t)); + if(!pluginData) + goto fail; + int error; /* |