[alsa-devel] coverity fix in alsa-libs

Renu Tyagi renu.tyagi at samsung.com
Mon Sep 15 11:25:24 CEST 2014


Hi,

I ran Coverity analysis tool on alsa and found some bugs.
Bug and Patch description

1. Changed file  :  aserver.c
Socket not closed before returning when bind fails
Community Code:

if (bind(sock, (struct sockaddr *) addr, size) < 0) {
int result = -errno;
SYSERROR("bind failed");
return result;
} 
return sock;
}

Recommended Code :

if (bind(sock, (struct sockaddr *) addr, size) < 0) {
	int result = -errno;
	SYSERROR("bind failed");                                                
	close(sock);                                                
	return result;                                                                                              
}
return sock;
}

2.Changed file : control_shm.c
Socket not closed before returning when connect fails

Community Code:
if (connect(sock, (struct sockaddr *) addr, size) < 0)
    return -errno;
	return sock;
}

Recommended Code :
if (connect(sock, (struct sockaddr *) addr, size) < 0){
    SYSERR("connect failed");
    close(sock);
    return -errno;
	}
return sock;
}

3.Changed file : pcm_shm.c
Socket not closed before returning when connect fails

Community Code:
if (connect(sock, (struct sockaddr *) addr, size) < 0) {
   SYSERR("connect failed");                                           
	return -errno;
   }
 return sock;
}
Recommended Code :
if (connect(sock, (struct sockaddr *) addr, size) < 0) {
 SYSERR("connect failed");
 close(sock);
 return -errno;
 }
return sock;
}

PFA patch. 

 

 

Thanks & Regards, 

Renu Tyagi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 22581.patch
Type: application/octet-stream
Size: 1196 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20140915/78a3d733/attachment.obj>


More information about the Alsa-devel mailing list