[Bf-blender-cvs] [d993bad] master: Fix possible NULL pointer dereference

Campbell Barton noreply at git.blender.org
Mon Dec 29 22:19:20 CET 2014


Commit: d993bad5e7adc35ad984dec1bbf0a57d99000712
Author: Campbell Barton
Date:   Tue Dec 30 07:37:59 2014 +1100
Branches: master
https://developer.blender.org/rBd993bad5e7adc35ad984dec1bbf0a57d99000712

Fix possible NULL pointer dereference

also remove redundant NULL check

===================================================================

M	source/blender/editors/interface/interface_utils.c
M	source/blender/editors/sound/sound_ops.c

===================================================================

diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index c083a28..28bd637 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -83,8 +83,12 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
 			int arraylen = RNA_property_array_length(ptr, prop);
 
 			if (arraylen && index == -1) {
-				if (ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA))
+				if (ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA)) {
 					but = uiDefButR_prop(block, UI_BTYPE_COLOR, 0, name, x1, y1, x2, y2, ptr, prop, -1, 0, 0, -1, -1, NULL);
+				}
+				else {
+					return NULL;
+				}
 			}
 			else if (RNA_property_subtype(prop) == PROP_PERCENTAGE || RNA_property_subtype(prop) == PROP_FACTOR)
 				but = uiDefButR_prop(block, UI_BTYPE_NUM_SLIDER, 0, name, x1, y1, x2, y2, ptr, prop, index, 0, 0, -1, -1, NULL);
diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c
index 2f5dc0c..1a34894 100644
--- a/source/blender/editors/sound/sound_ops.c
+++ b/source/blender/editors/sound/sound_ops.c
@@ -142,7 +142,7 @@ static int sound_open_exec(bContext *C, wmOperator *op)
 		RNA_property_update(C, &pprop->ptr, pprop->prop);
 	}
 
-	if (op->customdata) MEM_freeN(op->customdata);
+	MEM_freeN(op->customdata);
 	return OPERATOR_FINISHED;
 }




More information about the Bf-blender-cvs mailing list