* Minor fixups in rasm

This commit is contained in:
Nibble 2010-01-08 20:28:17 +01:00
parent 42f79227c9
commit 17b8713327

View File

@ -59,7 +59,7 @@ R_API struct r_asm_t *r_asm_new()
R_API void* r_asm_code_free(struct r_asm_code_t *acode) R_API void* r_asm_code_free(struct r_asm_code_t *acode)
{ {
if (!acode) if (!acode)
return; return NULL;
if (acode->buf) if (acode->buf)
free(acode->buf); free(acode->buf);
if (acode->buf_hex) if (acode->buf_hex)
@ -385,7 +385,7 @@ R_API struct r_asm_code_t *r_asm_massemble(struct r_asm_t *a, const char *buf)
acode->len = idx + ret; acode->len = idx + ret;
if(!(acode->buf = realloc(acode->buf, idx+ret))) if(!(acode->buf = realloc(acode->buf, idx+ret)))
return r_asm_code_free(acode); return r_asm_code_free(acode);
if(!(acode->buf_hex = realloc(acode->buf_hex, idx+ret))) if(!(acode->buf_hex = realloc(acode->buf_hex, (idx+ret)*2+1)))
return r_asm_code_free(acode); return r_asm_code_free(acode);
for (j = 0; j < ret; j++) for (j = 0; j < ret; j++)
acode->buf[idx+j] = aop.buf[j]; acode->buf[idx+j] = aop.buf[j];