Changeset 3453

Show
Ignore:
Timestamp:
08/09/07 13:51:36 (1 year ago)
Author:
tg
Message:

handle NULL pointers in str_add, str_nadd

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/common-nfo/tools/sqlite/dbif.h

    r3447 r3453  
    130130        size_t str_nadd_sz, str_nadd_addsz = (n);       \ 
    131131                                                        \ 
    132         str_nadd_sz = strlen(str_nadd_ptr);             \ 
    133         str_nadd_newptr = xrealloc(str_nadd_ptr,        \ 
    134             str_nadd_sz + str_nadd_addsz + 1);          \ 
     132        str_nadd_sz = str_nadd_ptr ?                    \ 
     133            strlen(str_nadd_ptr) : 0;                   \ 
     134        str_nadd_newptr = str_nadd_ptr ?                \ 
     135            xrealloc(str_nadd_ptr,                      \ 
     136            str_nadd_sz + str_nadd_addsz + 1) :         \ 
     137            xmalloc(str_nadd_addsz + 1);                \ 
    135138        str_nadd_ptr = str_nadd_newptr + str_nadd_sz;   \ 
    136139        memcpy(str_nadd_ptr, (s), str_nadd_addsz);      \