comparison m_option.c @ 31493:0a7222a42a70

Ensure that e.g. -af-pre will not cause the filter list to be unterminated when the list was empty before. Should fix bug #1687.
author reimar
date Fri, 25 Jun 2010 16:56:40 +0000
parents 92f88bb315c5
children 64ba1daa147a
comparison
equal deleted inserted replaced
31492:e4d6cf87aa06 31493:0a7222a42a70
483 /**/; 483 /**/;
484 484
485 lst = realloc(lst,(n+ln+1)*sizeof(char*)); 485 lst = realloc(lst,(n+ln+1)*sizeof(char*));
486 486
487 if(pre) { 487 if(pre) {
488 memmove(&lst[n],lst,(ln+1)*sizeof(char*)); 488 memmove(&lst[n],lst,ln*sizeof(char*));
489 memcpy(lst,add,n*sizeof(char*)); 489 memcpy(lst,add,n*sizeof(char*));
490 } else 490 } else
491 memcpy(&lst[ln],add,(n+1)*sizeof(char*)); 491 memcpy(&lst[ln],add,n*sizeof(char*));
492 // (re-)add NULL-termination
493 lst[ln+n] = NULL;
492 494
493 free(add); 495 free(add);
494 496
495 VAL(dst) = lst; 497 VAL(dst) = lst;
496 498