summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkramm <kramm>2004-04-08 09:23:30 +0000
committerkramm <kramm>2004-04-08 09:23:30 +0000
commit2206626c3b7fa0997a2472a28b78f3d42bfd2ae7 (patch)
tree203b5872a086ed9ad210606f803686a74a6e9c9d
parent9a8ddb9599319c1ba2d51066dc071968c8ddeeb0 (diff)
fixed another malloc(0)stable_core_1
-rw-r--r--lib/python/tag.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/python/tag.c b/lib/python/tag.c
index 5bc539fb..65e19b35 100644
--- a/lib/python/tag.c
+++ b/lib/python/tag.c
@@ -362,21 +362,23 @@ TAG* tag_getTAG(PyObject*self, TAG*prevTag, PyObject*tagmap)
}
int num = swf_GetNumUsedIDs(t);
- int * positions = malloc(num*sizeof(int));
- swf_GetUsedIDs(t, positions);
- int i;
- for(i=0;i<num;i++) {
- int id = GET16(&t->data[positions[i]]);
- PyObject* obj = tagmap_id2obj(tag->tagmap, id);
- if(obj==NULL) {
- PyErr_SetString(PyExc_Exception, setError("Internal error: id %d not known in taglist:"));
- free(positions);
- return 0;
+ if(num) { // tag has dependencies
+ int * positions = malloc(num*sizeof(int));
+ swf_GetUsedIDs(t, positions);
+ int i;
+ for(i=0;i<num;i++) {
+ int id = GET16(&t->data[positions[i]]);
+ PyObject* obj = tagmap_id2obj(tag->tagmap, id);
+ if(obj==NULL) {
+ PyErr_SetString(PyExc_Exception, setError("Internal error: id %d not known in taglist:"));
+ free(positions);
+ return 0;
+ }
+ int newid = tagmap_obj2id(tagmap, obj);
+ PUT16(&t->data[positions[i]], newid);
}
- int newid = tagmap_obj2id(tagmap, obj);
- PUT16(&t->data[positions[i]], newid);
+ free(positions);
}
- free(positions);
return t;
}