pos = (unsigned char *)malloc(len*sizeof(unsigned char));
z = jacu_buscar_z(datos, len, &size);
- *_z = (unsigned char*)malloc(len*sizeof(unsigned char));
- memcpy(*_z, z, len*sizeof(unsigned char));
+ *_z = (unsigned char*)malloc(size*sizeof(unsigned char));
+ memcpy(*_z, z, size*sizeof(unsigned char));
for(i=0; i<len; i++){
pos[i] = get_pos(z, size, datos[i]);
if (pos[i] != 0)
pop_front(z, pos[i]);
}
(*z_len) = size;
+ free(z);
return pos;
}