Closed a tiny memory leak found by valgrind.

This commit is contained in:
Thomas Schmitt 2009-08-20 17:06:11 +02:00
parent 62edebad06
commit 72e9c67d05

View File

@ -1234,12 +1234,16 @@ int add_aa_string(Ecma119Image *t, Ecma119Node *n, struct susp_info *info,
if (ret == 1) { if (ret == 1) {
num_aapt = aaip_count_bytes((unsigned char *) xipt, 0); num_aapt = aaip_count_bytes((unsigned char *) xipt, 0);
if (num_aapt > 0) { if (num_aapt > 0) {
aapt = malloc(num_aapt); if (flag & 1) {
if (aapt == NULL) ret = aaip_add_AL(t, NULL,NULL, num_aapt, sua_free, ce_len, 1);
return ISO_OUT_OF_MEM; } else {
memcpy(aapt, xipt, num_aapt); aapt = malloc(num_aapt);
ret = aaip_add_AL(t, info, &aapt, num_aapt, sua_free, ce_len, if (aapt == NULL)
flag & 1); return ISO_OUT_OF_MEM;
memcpy(aapt, xipt, num_aapt);
ret = aaip_add_AL(t, info, &aapt, num_aapt, sua_free, ce_len,
0);
}
if (ret < 0) if (ret < 0)
return ret; return ret;
/* aapt is NULL now and the memory is owned by t */ /* aapt is NULL now and the memory is owned by t */