diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-12-26 02:59:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-12-26 02:59:12 +0300 |
commit | fb4f78513e0cba6187646e950806f71cd42b7bae (patch) | |
tree | e2b248f0219f913d055574aca8e4928511536697 /source | |
parent | fc066a6a5d01718981c9dcae23c5f4f47f3d7b1e (diff) |
invalid memory access fix
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index e2960d2bf3a..9cc08b297e5 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -946,7 +946,7 @@ void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, En int RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *value) { EnumPropertyItem *item, *item_array; - int free; + int free, found; RNA_property_enum_items(C, ptr, prop, &item_array, NULL, &free); @@ -956,11 +956,13 @@ int RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, con break; } } + + found= (item->identifier != NULL); /* could be alloc'd, assign before free */ if(free) MEM_freeN(item_array); - return (item->identifier) ? 1:0; + return found; } int RNA_enum_identifier(EnumPropertyItem *item, const int value, const char **identifier) |