More fixes from coverity report.
authorBastien Montagne <montagne29@wanadoo.fr>
Tue, 16 Aug 2016 16:19:52 +0000 (18:19 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Tue, 16 Aug 2016 16:19:52 +0000 (18:19 +0200)
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/smoke.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/editors/animation/anim_channels_defines.c
source/blender/makesrna/intern/rna_scene_api.c
source/gameengine/Ketsji/KX_NavMeshObject.cpp

index 1a5d77bbc07a625833a38c416f76e155cab2a8a3..e3764adb9696a88a0558c0e06d5c618fd03ca99a 100644 (file)
@@ -1513,7 +1513,7 @@ static bool animsys_store_rna_setting(
                                if (array_len && array_index >= array_len) {
                                        if (G.debug & G_DEBUG) {
                                                printf("Animato: Invalid array index. ID = '%s',  '%s[%d]', array length is %d\n",
-                                                      (ptr && ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>",
+                                                      (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>",
                                                       path, array_index, array_len - 1);
                                        }
                                }
index 3fc72628c971379220c93e4c0769926bf5f1017d..f622d541f3aef64d619ecd68398d1094bff4d9ad 100644 (file)
@@ -3051,9 +3051,15 @@ float smoke_get_velocity_at(struct Object *ob, float position[3], float velocity
 int smoke_get_data_flags(SmokeDomainSettings *sds)
 {
        int flags = 0;
-       if (smoke_has_heat(sds->fluid)) flags |= SM_ACTIVE_HEAT;
-       if (smoke_has_fuel(sds->fluid)) flags |= SM_ACTIVE_FIRE;
-       if (smoke_has_colors(sds->fluid)) flags |= SM_ACTIVE_COLORS;
+
+       if (sds->fluid) {
+               if (smoke_has_heat(sds->fluid))
+                       flags |= SM_ACTIVE_HEAT;
+               if (smoke_has_fuel(sds->fluid))
+                       flags |= SM_ACTIVE_FIRE;
+               if (smoke_has_colors(sds->fluid))
+                       flags |= SM_ACTIVE_COLORS;
+       }
 
        return flags;
 }
index 9dbc045f1b04aaf29ce3a88acae08b27173bb45a..de55a1977bfd19cb754f4768794ca65419b85e9d 100644 (file)
@@ -1393,7 +1393,7 @@ int BKE_ffmpeg_property_add_string(RenderData *rd, const char *type, const char
        
        avcodec_get_context_defaults3(&c, NULL);
 
-       strncpy(name_, str, sizeof(name_));
+       BLI_strncpy(name_, str, sizeof(name_));
 
        name = name_;
        while (*name == ' ') name++;
index 3085e383909e08756b3836e215343e094fd8f377..d727ea0a957916a3058ca471991ec1c214d97891 100644 (file)
@@ -3901,7 +3901,12 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void
        
        /* send notifiers before doing anything else... */
        WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-       
+
+       /* verify that we have a channel to operate on. */
+       if (!ale_setting) {
+               return;
+       }
+
        if (ale_setting->type == ANIMTYPE_GPLAYER)
                WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, NULL);
        
@@ -3909,17 +3914,13 @@ static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void
        if (ANIM_animdata_get_context(C, &ac) == 0)
                return;
        
-       /* verify that we have a channel to operate on, and that it has all we need */
-       if (ale_setting) {
-               /* check if the setting is on... */
-               on = ANIM_channel_setting_get(&ac, ale_setting, setting);
-               
-               /* on == -1 means setting not found... */
-               if (on == -1)
-                       return;
-       }
-       else
+       /* check if the setting is on... */
+       on = ANIM_channel_setting_get(&ac, ale_setting, setting);
+
+       /* on == -1 means setting not found... */
+       if (on == -1) {
                return;
+       }
        
        /* get all channels that can possibly be chosen - but ignore hierarchy */
        filter = ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_CHANNELS;
index ed51f0cffb0137e66af551a7312b3f082c6066bf..519f28bea24da3664328f311465a5d7425bd62be 100644 (file)
@@ -278,8 +278,8 @@ static void rna_Scene_collada_export(
         int use_object_instantiation,
         int use_blender_profile,
         int sort_by_name,
-        int export_transformation_type,
-        int open_sim)
+        int open_sim,
+        int export_transformation_type)
 {
        collada_export(scene, filepath, apply_modifiers, export_mesh_type, selected,
                       include_children, include_armatures, include_shapekeys, deform_bones_only,
index b8907ca5c6b40f0f396bab077288ce66bcfe5d19..5beda2e038af5e13faa21752b1f8f523ce7af1e4 100644 (file)
@@ -306,7 +306,12 @@ bool KX_NavMeshObject::BuildNavMesh()
                        || vertsPerPoly<3)
        {
                printf("Can't build navigation mesh data for object:%s\n", m_name.ReadPtr());
-               if (vertices) delete[] vertices;
+               if (vertices) {
+                       delete[] vertices;
+               }
+               if (dvertices) {
+                       delete[] dvertices;
+               }
                return false;
        }