Fixed latest pubsub Coverity issues
@@ -82,7 +82,7 @@ celix_status_t pubsubSerializer_destroy(pubsub_serializer_t* serializer) {
celix_status_t pubsubSerializer_createSerializerMap(pubsub_serializer_t* serializer, bundle_pt bundle, pubsub_msg_serializer_map_t** out) {
celix_status_t status = CELIX_SUCCESS;
pubsub_msg_serializer_map_t* map = calloc(1, sizeof(*map));
- if (status == CELIX_SUCCESS) {
+ if (map != NULL) {
map->bundle = bundle;
map->serializers = hashMap_create(NULL, NULL, NULL, NULL);
pubsubSerializer_fillMsgSerializerMap(map->serializers, bundle);
@@ -143,7 +143,7 @@ celix_status_t pubsubMsgSerializer_deserialize(pubsub_msg_serializer_impl_t* imp
if (rc != 0) {
status = CELIX_BUNDLE_EXCEPTION;
}
- if (status == CELIX_SUCCESS) {
+ else{
*out = msg;
}
return status;
@@ -230,10 +230,12 @@ static void pubsubSerializer_addMsgSerializerFromBundle(const char *root, bundle
if (rc == 0 && msgType != NULL) {
char* msgName = NULL;
- dynMessage_getName(msgType,&msgName);
+ rc += dynMessage_getName(msgType,&msgName);
version_pt msgVersion = NULL;
- dynMessage_getVersion(msgType, &msgVersion);
+ rc += dynMessage_getVersion(msgType, &msgVersion);
+
+ if(rc == 0 && msgName != NULL && msgVersion != NULL){
unsigned int msgId = utils_stringHash(msgName);
@@ -252,13 +254,17 @@ static void pubsubSerializer_addMsgSerializerFromBundle(const char *root, bundle
printf("Cannot add msg %s. clash in msg id %d!!\n", msgName, msgId);
free(impl);
dynMessage_destroy(msgType);
- } else if ( msgName != NULL && msgVersion != NULL && msgId != 0) {
+ } else if (msgId != 0) {
hashMap_put(msgSerializers, (void*)(uintptr_t)msgId, &impl->msgSerializer);
} else {
printf("Error creating msg serializer\n");
free(impl);
dynMessage_destroy(msgType);
}
+ }
+ else{
+ printf("Cannot retrieve name and/or version from msg\n");
+ }
} else{
printf("DMU: cannot parse message from descriptor %s\n.",path);
