OSDN Git Service

calloc 直後のエラーで free するのを、エラーの後で calloc するよう変更
authoryoya <yoya@7c90b180-03d5-4157-b861-58a559ae9d1e>
Thu, 17 Mar 2011 07:33:15 +0000 (07:33 +0000)
committeryoya <yoya@7c90b180-03d5-4157-b861-58a559ae9d1e>
Thu, 17 Mar 2011 07:33:15 +0000 (07:33 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/swfed/trunk@435 7c90b180-03d5-4157-b861-58a559ae9d1e

src/swf_tag.c

index b105cd7..f7cae1d 100644 (file)
@@ -84,13 +84,12 @@ swf_tag_t *swf_tag_create(bitstream_t *bs) {
         fprintf(stderr, "swf_tag_create: bs == NULL\n");
         return NULL;
     }
-    tag = calloc(sizeof(*tag), 1);
     tag_and_length = bitstream_getbytesLE(bs, 2);
     if (tag_and_length == (unsigned short) -1) {
         fprintf(stderr, "swf_tag_create: tag_and_length(short) == -1\n");
-        free(tag);
         return NULL;
     }
+    tag = calloc(sizeof(*tag), 1);
     tag->tag = tag_and_length >> 6;
     tag->length = tag_and_length & 0x3f;
     tag->length_longformat = 0;