Fixed small leak in PSA UDP_MC topic_subscription
@@ -243,11 +243,7 @@ celix_status_t pubsub_topicSubscriptionConnectPublisher(topic_subscription_pt ts
celix_status_t status = CELIX_SUCCESS;
celixThreadMutex_lock(&ts->ts_lock);
- if(hashMap_containsKey(ts->socketMap, pubURL)){
- printf("PSA_UDM_MC_TS: PubURL %s already existing!\n",pubURL);
- celixThreadMutex_unlock(&ts->ts_lock);
- return CELIX_SERVICE_EXCEPTION;
- }
+ if(!hashMap_containsKey(ts->socketMap, pubURL)){
int *recvSocket = calloc(sizeof(int), 1);
*recvSocket = socket(AF_INET, SOCK_DGRAM, 0);
@@ -318,10 +314,11 @@ celix_status_t pubsub_topicSubscriptionConnectPublisher(topic_subscription_pt ts
if (status == CELIX_SUCCESS){
hashMap_put(ts->socketMap, strdup(pubURL), (void*)recvSocket);
- }else{
+ }
+ else{
free(recvSocket);
}
-
+ }
celixThreadMutex_unlock(&ts->ts_lock);
return status;
