Просмотр исходного кода

ncd: modules: explode: fix a malloc(0)

ambrop7 13 лет назад
Родитель
Сommit
ad80c756ff
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      ncd/modules/explode.c

+ 4 - 4
ncd/modules/explode.c

@@ -138,8 +138,8 @@ static void func_new (void *vo, NCDModuleInst *i)
         
         struct substring *elem = &((struct substring *)o->arr.v)[o->num];
         
-        if (!(elem->data = malloc(start))) {
-            ModuleLog(i, BLOG_ERROR, "malloc failed");
+        if (!(elem->data = BAlloc(start))) {
+            ModuleLog(i, BLOG_ERROR, "BAlloc failed");
             goto fail2;
         }
         
@@ -164,7 +164,7 @@ static void func_new (void *vo, NCDModuleInst *i)
 
 fail2:
     while (o->num-- > 0) {
-        free(((struct substring *)o->arr.v)[o->num].data);
+        BFree(((struct substring *)o->arr.v)[o->num].data);
     }
     free(o->arr.v);
 fail1:
@@ -179,7 +179,7 @@ static void func_die (void *vo)
     struct instance *o = vo;
     
     while (o->num-- > 0) {
-        free(((struct substring *)o->arr.v)[o->num].data);
+        BFree(((struct substring *)o->arr.v)[o->num].data);
     }
     free(o->arr.v);