X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=src%2Flabel.c;h=a65e2939e45c484edc33aa0c75b61960d7292f99;hp=c705ad11600aa3ffb81bb73825f757a14ad92dc8;hb=4ee27a568fb9222907a566e59aaefe248f08a8e4;hpb=5562b8293058464957a1f833777e187a78220ed5 diff --git a/src/label.c b/src/label.c index c705ad1..a65e293 100644 --- a/src/label.c +++ b/src/label.c @@ -10,11 +10,11 @@ unsigned labelhash(const char *prog, const char *label) HKEY *keys[2]; int i = 0; if(prog != NULL) { - keys[i] = malloc(sizeof(HKEY)); + keys[i] = malloc_chk(sizeof(HKEY), "labelhash.key"); keys[i]->type = CHARS; keys[i++]->val.s = strdup(prog); } - keys[i] = malloc(sizeof(HKEY)); + keys[i] = malloc_chk(sizeof(HKEY), "labelhash.key"); keys[i]->type = CHARS; keys[i]->val.s = strdup(label); /* ハッシュ値を返す */ @@ -49,7 +49,7 @@ bool addlabel(const char *prog, const char *label, WORD adr) return false; } /* メモリを確保 */ - if((np = malloc(sizeof(LABELTAB))) == NULL) { + if((np = malloc_chk(sizeof(LABELTAB), "addlabel.np")) == NULL) { goto cerr102; } /* プログラム名を設定 */ @@ -93,7 +93,7 @@ void printlabel() for(i = 0; i < LABELTABSIZE; i++) { for(np = labels[i]; np != NULL; np = np->next) { assert(np->label != NULL); - ar[asize] = malloc(sizeof(LABELARRAY)); + ar[asize] = malloc_chk(sizeof(LABELARRAY), "ar[asize]"); ar[asize]->prog = (np->prog == NULL ? NULL : strdup(np->prog)); ar[asize]->label = strdup(np->label); ar[asize++]->adr = np->adr;