Fix Coverity Scan issues.
511427 1431133 1436823 1436837 1436838 1436929
This commit is contained in:
parent
c3ae8c174f
commit
d142ff69a6
@ -109,7 +109,7 @@ int load_file(const char *filename)
|
||||
cfg.message = NULL;
|
||||
cfg.msglen = 0;
|
||||
return 0;
|
||||
}else if(cfg.msglen < 0){
|
||||
}else if(flen < 0){
|
||||
fclose(fptr);
|
||||
err_printf(&cfg, "Error: Unable to determine size of file \"%s\".\n", filename);
|
||||
return 1;
|
||||
|
@ -399,8 +399,8 @@ int bridge__connect(struct mosquitto *context)
|
||||
if (!context->bridge->notifications_local_only) {
|
||||
notification_payload = '0';
|
||||
rc = will__set(context, notification_topic, 1, ¬ification_payload, 1, true, NULL);
|
||||
mosquitto__free(notification_topic);
|
||||
if(rc != MOSQ_ERR_SUCCESS){
|
||||
mosquitto__free(notification_topic);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ int listeners__start(struct mosquitto__listener_sock **listensock, int *listenso
|
||||
if(listeners__start_local_only(listensock, listensock_count)){
|
||||
db__close();
|
||||
if(db.config->pid_file){
|
||||
remove(db.config->pid_file);
|
||||
(void)remove(db.config->pid_file);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -315,7 +315,7 @@ int listeners__start(struct mosquitto__listener_sock **listensock, int *listenso
|
||||
if(listeners__start_single_mqtt(listensock, listensock_count, &listensock_index, &db.config->listeners[i])){
|
||||
db__close();
|
||||
if(db.config->pid_file){
|
||||
remove(db.config->pid_file);
|
||||
(void)remove(db.config->pid_file);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -649,7 +649,11 @@ static int net__socket_listen_tcp(struct mosquitto__listener *listener)
|
||||
#endif
|
||||
#ifdef IPV6_V6ONLY
|
||||
ss_opt = 1;
|
||||
setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &ss_opt, sizeof(ss_opt));
|
||||
if(setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &ss_opt, sizeof(ss_opt)) < 0){
|
||||
log__printf(NULL, MOSQ_LOG_WARNING,
|
||||
"Warning when setting listener IPv6 mode: %s.\n",
|
||||
strerror(errno));
|
||||
}
|
||||
#endif
|
||||
|
||||
if(net__socket_nonblock(&sock)){
|
||||
|
@ -246,10 +246,11 @@ static int sub__add_shared(struct mosquitto *context, uint8_t qos, uint32_t iden
|
||||
for(i=0; i<context->shared_sub_count; i++){
|
||||
if(!context->shared_subs[i]){
|
||||
context->shared_subs[i] = shared_ref;
|
||||
shared_ref = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i == context->shared_sub_count){
|
||||
if(shared_ref){
|
||||
shared_subs = mosquitto__realloc(context->shared_subs, sizeof(struct mosquitto__subhier_ref *)*(size_t)(context->shared_sub_count + 1));
|
||||
if(!shared_subs){
|
||||
mosquitto__free(shared_ref);
|
||||
|
Loading…
Reference in New Issue
Block a user