diff --git a/swad_changelog.h b/swad_changelog.h index 3cfc18138..db2a528a2 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -189,13 +189,14 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 16.111.9 (2016-12-29)" +#define Log_PLATFORM_VERSION "SWAD 16.111.10 (2016-12-29)" #define CSS_FILE "swad16.111.5.css" #define JS_FILE "swad16.101.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 /* + Version 16.111.10:Dec 29, 2016 Fixed minor bug in groups, reported by Coverity. (211146 lines) Version 16.111.9: Dec 29, 2016 Fixed bugs in lstat, reported by Coverity. (211138 lines) Version 16.111.8: Dec 28, 2016 Fixed bug in notifications, reported by Coverity. (211119 lines) Version 16.111.7: Dec 28, 2016 Fixed minor bug in groups, reported by Coverity. (211114 lines) diff --git a/swad_group.c b/swad_group.c index dc8812bd7..b23fad195 100644 --- a/swad_group.c +++ b/swad_group.c @@ -527,8 +527,8 @@ void Grp_ChangeMyGrps (void) Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS); /***** Get the group codes which I want to join to *****/ - LstGrpsIWant.NumGrps = 0; // Initialized to avoid bug reported by Coverity LstGrpsIWant.GrpCod = NULL; // Initialized to avoid bug reported by Coverity + LstGrpsIWant.NumGrps = 0; // Initialized to avoid bug reported by Coverity Grp_GetLstCodsGrpWanted (&LstGrpsIWant); /***** A student can not be enrolled in more than one group @@ -577,8 +577,8 @@ void Grp_ChangeOtherUsrGrps (void) Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS); /***** Get the list of groups to which register this user *****/ - LstGrpsUsrWants.NumGrps = 0; // Initialized to avoid bug reported by Coverity - LstGrpsUsrWants.GrpCod = NULL; // Initialized to avoid bug reported by Coverity + // LstGrpsUsrWants.GrpCod = NULL; // Initialized to avoid bug reported by Coverity + // LstGrpsUsrWants.NumGrps = 0; // Initialized to avoid bug reported by Coverity Grp_GetLstCodsGrpWanted (&LstGrpsUsrWants); /***** A student can not be enrolled in more than one group @@ -922,7 +922,10 @@ void Grp_RegisterUsrIntoGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGr extern const char *Txt_THE_USER_X_has_been_removed_from_the_group_of_type_Y_to_which_it_belonged; extern const char *Txt_THE_USER_X_has_been_enrolled_in_the_group_of_type_Y_Z; struct ListCodGrps LstGrpsHeBelongs; - unsigned NumGrpTyp,NumGrpSel,NumGrpThisType,NumGrpHeBelongs; + unsigned NumGrpTyp; + unsigned NumGrpSel; + unsigned NumGrpThisType; + unsigned NumGrpHeBelongs; bool MultipleEnrollment; bool AlreadyRegisteredInGrp; @@ -934,6 +937,8 @@ void Grp_RegisterUsrIntoGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGr MultipleEnrollment = Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MultipleEnrollment; /***** Query in the database the group codes of any group of this type the student belongs to *****/ + // LstGrpsHeBelongs.NumGrps = 0; // Initialized to avoid bug reported by Coverity + // LstGrpsHeBelongs.GrpCod = NULL;// Initialized to avoid bug reported by Coverity Grp_GetLstCodGrpsUsrBelongs (Gbl.CurrentCrs.Crs.CrsCod,Gbl.CurrentCrs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod, UsrDat->UsrCod,&LstGrpsHeBelongs); @@ -4201,13 +4206,15 @@ void Grp_GetLstCodsGrpWanted (struct ListCodGrps *LstGrpsWanted) } /*****************************************************************************/ -/************************* Liberar list of group codes ***********************/ +/************************** Free list of group codes *************************/ /*****************************************************************************/ void Grp_FreeListCodGrp (struct ListCodGrps *LstGrps) { - if (LstGrps->NumGrps) + if (LstGrps->NumGrps && LstGrps->GrpCod) free ((void *) LstGrps->GrpCod); + LstGrps->GrpCod = NULL; + LstGrps->NumGrps = 0; } /*****************************************************************************/