[Freeassociation-devel] A new bunch of patches

Alvaro Manera alvaro.manera at nokia.com
Fri Jun 12 04:03:11 PDT 2009


Hi

Here are more patches for review. This time is more or less what I have been 
submitting so far.

1) No freeing in case of error
2) Leak in case of parameter error
3) Seeking in a file not checking that the position is seekable
4) Leak in case of parameter error
5) Missing break in a switch.

Just let me know if I can commit these ones and the previous also.

Álvaro

Index: src/libical/icaltimezone.c
===================================================================
--- src/libical/icaltimezone.c  (revision 930)
+++ src/libical/icaltimezone.c  (working copy)
@@ -1631,8 +1631,10 @@

        if (parse_coord (lat, lon - lat, latitude_degrees, latitude_minutes, 
latitude_seconds) == 1 ||
                        parse_coord (lon, strlen (lon), longitude_degrees, 
longitude_minutes, longitude_seconds)
-                       == 1)
-                       return 1;
+                       == 1) {
+                               free(lat);
+                               return 1;
+                       }

        free (lat);

Index: src/libical/icalderivedvalue.c.in
===================================================================
--- src/libical/icalderivedvalue.c.in   (revision 930)
+++ src/libical/icalderivedvalue.c.in   (working copy)
@@ -102,9 +102,11 @@
 }

 icalvalue* icalvalue_new_x (const char* v){
-   struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_X_VALUE);
+   struct icalvalue_impl* impl;
    icalerror_check_arg_rz( (v!=0),"v");

+   impl = icalvalue_new_impl(ICAL_X_VALUE);
+
    icalvalue_set_x((icalvalue*)impl,v);
    return (icalvalue*)impl;
 }
Index: src/libicalvcal/vcc.y
===================================================================
--- src/libicalvcal/vcc.y       (revision 930)
+++ src/libicalvcal/vcc.y       (working copy)
@@ -1164,7 +1164,8 @@
     initLex(0,(unsigned long)-1,file);
     startPos = ftell(file);
     if (!(result = Parse_MIMEHelper())) {
-       fseek(file,startPos,SEEK_SET);
+       if (startPos >= 0)
+          fseek(file,startPos,SEEK_SET);
        }
     return result;
     }
Index: src/libicalvcal/icalvcal.c
===================================================================
--- src/libicalvcal/icalvcal.c  (revision 930)
+++ src/libicalvcal/icalvcal.c  (working copy)
@@ -167,12 +167,14 @@
 {

    char* name =  (char*)vObjectName(object);
-   icalcomponent* container = icalcomponent_new(ICAL_XROOT_COMPONENT);
+   icalcomponent* container;
    icalcomponent* root;
    icalproperty *prop;

    icalerror_check_arg_rz( (object!=0),"Object");

+   container = icalcomponent_new(ICAL_XROOT_COMPONENT);
+
    /* The root object must be a VCALENDAR */
    if(*name==0 || strcmp(name,VCCalProp) != 0){
        return 0; /* HACK. Should return an error */
Index: src/libicalss/icalspanlist.c
===================================================================
--- src/libicalss/icalspanlist.c        (revision 930)
+++ src/libicalss/icalspanlist.c        (working copy)
@@ -555,6 +555,7 @@
     case ICAL_FBTYPE_NONE:
     case ICAL_FBTYPE_X:
       s->is_busy = 1;
+      break;
     default:
       s->is_busy = 0;
     }




More information about the libical-devel mailing list