Commit 8dab9c84 authored by stettberger's avatar stettberger

Code Cleanup

parent 9c1a2ddd
......@@ -91,10 +91,7 @@ static void add_channel(SilcChannelEntry channel) {
return;
}
c = calloc(1, sizeof(Channel));
if(!c) {
perror("si: cannot allocate memory");
exit(EXIT_FAILURE);
}
NULL_TEST_ARG(c, exit(1));
if(!channels)
channels = c;
else {
......@@ -151,21 +148,15 @@ void add_query(SilcClientEntry peer) {
if (SILC_ID_CLIENT_COMPARE(peer->id, q->silc->id))
return; /* Already handled */
path=malloc(strlen(peer->nickname)+8);
if (!path) {
perror("si: couldn't allocate memory");
return;
}
NULL_TEST_ARG(path,exit(1));
sprintf(path, "query/%s", peer->nickname);
fd=open_channel(path);
if(!fd){
perror("si: Couldn't create Query");
return;
}
q=silc_calloc(1, sizeof(Query));
if (!q) {
perror("si: Couldn't allocate memory");
return;
}
q=calloc(1, sizeof(Query));
NULL_TEST_ARG(q, exit(1));
/* Write to the query */
print_out(path, "-!- You opened the query");
if (!queries) {
......@@ -196,10 +187,7 @@ void handle_query_input ( Query *peer ){
char *path;
if(read_line(peer->fd, PIPE_BUF, buf) == -1) {
path=malloc(strlen(peer->silc->nickname)+8);
if (!path) {
perror("si: couldn't allocate memory");
return;
}
NULL_TEST(path);
int fd = open_channel(path);
if(fd != -1)
peer->fd = fd;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment