Commit 43eeccb7 authored by 's avatar

added missing free(dbuf), fixed some warnings


git-svn-id: file:///home/svn/mapi/trunk@276 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 2d1ee05f
......@@ -69,7 +69,6 @@ int main(int argc, char **argv) {
die("Unexpected error on setsockopt()");
}
if (bind(serv_sock, (struct sockaddr *)&serv_addr, sizeof serv_addr) == -1) {
close(serv_sock);
die("Unexpected error on bind()");
......@@ -115,7 +114,6 @@ void *handle_request(void *arg) {
struct timezone tz;
struct mapipkt *pkt;
/* Guarantees that thread resources are deallocated upon return */
pthread_detach(pthread_self());
dbuf = (struct dmapiipcbuf *)malloc(sizeof(struct dmapiipcbuf));
......@@ -145,7 +143,7 @@ void *handle_request(void *arg) {
memcpy(dbuf,buffer,((struct dmapiipcbuf *)buffer)->length);
switch(dbuf->cmd) {
case CREATE_FLOW:
mapid_result = mapi_create_flow(dbuf->data);
mapid_result = mapi_create_flow((char *)dbuf->data);
fprintf(stdout,"CREATE_FLOW (%s, %d)\n",dbuf->data, mapid_result);
if(mapid_result <0)
dbuf->cmd = ERROR_ACK;
......@@ -337,6 +335,7 @@ void *handle_request(void *arg) {
}
}
free(active_flows);
free(dbuf);
shutdown(sock, SHUT_RDWR);
close(sock);
......@@ -381,8 +380,8 @@ int getfid(struct dmapiipcbuf *dbuf){
//for THRESHOLD
int type, boundary, divider;
unsigned long long lthreshold;
char* function=dbuf->data;
char* data=dbuf->data+strlen(dbuf->data)+1;
char *function = (char *)dbuf->data;
char *data = (char *)(dbuf->data+strlen((char *)dbuf->data)+1);
if(!strcmp(function,"BPF_FILTER")){//Checked
fprintf(stdout,"%s, %s\n",function, data);
......
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