Commit b590b550 authored by Cedric Roux's avatar Cedric Roux
Browse files

- Fixed memory leak for OMG

- Fixed compiler warning for OMG

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4385 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent b564e379
......@@ -73,7 +73,7 @@ mapping mob_type[] =
//#endif
NodePtr create_node(void) {
NodePtr ptr;
ptr = malloc(sizeof(node_struct));
ptr = calloc(1, sizeof(node_struct));
return ptr;
}
......@@ -91,7 +91,7 @@ double randomGen(double a, double b){
MobilityPtr create_mobility(void) {
MobilityPtr ptr;
ptr = malloc(sizeof(mobility_struct));
ptr = calloc(1, sizeof(mobility_struct));
return ptr;
}
......
......@@ -181,7 +181,7 @@ char * readString(){
char *tmp = (char *)malloc(sizeof(char) * (len));
char *ret = tmp; // JHNOTE: added a pointer pointing at the head of the String
//printf("OMG ready to readString of length %d \n",len);
for (i; i < len; i++) {
for (; i < len; i++) {
*tmp++ = (char) readChar();
}
*tmp++ = '\0'; // makes sure it's NUL terminated
......@@ -211,7 +211,7 @@ String_list readStringList(String_list vector){
descLen = len;
String_list entry = NULL;
for (i; i < len; i++) {
for (; i < len; i++) {
if (vector->string == NULL) {
char *tmp = readString();
//printf("OMG - 1 SUMO ID: %s \n",tmp);
......@@ -370,15 +370,15 @@ double readDouble(){
if (bigEndian)
{
// network is big endian
int i=0;
for (i; i<8; ++i)
int i = 0;
for (; i<8; ++i)
{
p_value[i] = readChar();
}
} else {
int i=7;
// network is big endian
for (i; i>=0; --i) {
for (; i>=0; --i) {
p_value[i] = readChar();
}
}
......@@ -391,13 +391,13 @@ void writeDouble(double value){
if (bigEndian)
{ int i=0;
// network is big endian
for (i; i<8; ++i)
for (; i<8; ++i)
{
writeChar(p_value[i]);
}
} else {int i=7;
// network is big endian
for (i; i>=0; --i)
for (; i>=0; --i)
{
writeChar(p_value[i]);
}
......@@ -420,7 +420,7 @@ storage* writePacket (unsigned char* packet, int length){
int i = 0;
for(i; i < length; i++) {
for(; i < length; i++) {
printf("in %d round \n",i);
//storage *temp_ = (storage *)malloc(sizeof(storage));
......
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