/ Check-in [ada5490f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Work around buggy malloc() implementations that cause problems on malloc(0). Ticket #1572. (CVS 2996)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ada5490f12795a8d13d0f42077c463709c677846
User & Date: drh 2006-01-23 13:14:55
Context
2006-01-23
13:22
Do not name variables "operator" because some compilers do not realize that "operator" is not a reserved word in ANSI-C. Ticket #1625. (CVS 2997) check-in: 1f42a338 user: drh tags: trunk
13:14
Work around buggy malloc() implementations that cause problems on malloc(0). Ticket #1572. (CVS 2996) check-in: ada5490f user: drh tags: trunk
13:09
Improve coverage of pager.c and fix an IO error handling bug found in the process. (CVS 2995) check-in: 6ec8e6b7 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/legacy.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Main file for the SQLite library.  The routines in this file
    13     13   ** implement the programmer interface to the library.  Routines in
    14     14   ** other files are for internal use by SQLite and should not be
    15     15   ** accessed by users of the library.
    16     16   **
    17         -** $Id: legacy.c,v 1.12 2006/01/18 15:25:17 danielk1977 Exp $
           17  +** $Id: legacy.c,v 1.13 2006/01/23 13:14:55 drh Exp $
    18     18   */
    19     19   
    20     20   #include "sqliteInt.h"
    21     21   #include "os.h"
    22     22   #include <ctype.h>
    23     23   
    24     24   /*
................................................................................
    64     64         continue;
    65     65       }
    66     66   
    67     67       db->nChange += nChange;
    68     68       nCallback = 0;
    69     69   
    70     70       nCol = sqlite3_column_count(pStmt);
    71         -    azCols = sqliteMalloc(2*nCol*sizeof(const char *));
    72         -    if( nCol && !azCols ){
           71  +    azCols = sqliteMalloc(2*nCol*sizeof(const char *) + 1);
           72  +    if( azCols==0 ){
    73     73         goto exec_out;
    74     74       }
    75     75   
    76     76       while( 1 ){
    77     77         int i;
    78     78         rc = sqlite3_step(pStmt);
    79     79