09c79b6096
At the start of the function we assign 'a->d' to 'ap'. Then we use the RESIZE_IF_NEEDED macro on 'a' - this may free 'a->d' and replace it with newly allocaetd storage. In that case, we'll be operating on freed memory further down in the function when we index into 'ap[]'. Since we don't actually need 'ap' until after the use of the RESIZE_IF_NEEDED macro we can just delay the assignment to it until after we've potentially resized, thus avoiding the issue. While I was there anyway I also changed the integer variable 'n' to be const. It might as well be since we only assign to it once and use it as a constant, and then the compiler will tell us if we ever assign to it in the future. Signed-off-by: Jesper Juhl <jj@chaosbits.net> Acked-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com> Signed-off-by: James Morris <james.l.morris@oracle.com> |
||
---|---|---|
.. | ||
generic_mpi-asm-defs.h | ||
generic_mpih-add1.c | ||
generic_mpih-lshift.c | ||
generic_mpih-mul1.c | ||
generic_mpih-mul2.c | ||
generic_mpih-mul3.c | ||
generic_mpih-rshift.c | ||
generic_mpih-sub1.c | ||
longlong.h | ||
Makefile | ||
mpi-add.c | ||
mpi-bit.c | ||
mpi-cmp.c | ||
mpi-div.c | ||
mpi-gcd.c | ||
mpi-inline.c | ||
mpi-inline.h | ||
mpi-internal.h | ||
mpi-inv.c | ||
mpi-mpow.c | ||
mpi-mul.c | ||
mpi-pow.c | ||
mpi-scan.c | ||
mpicoder.c | ||
mpih-cmp.c | ||
mpih-div.c | ||
mpih-mul.c | ||
mpiutil.c |