1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-09 14:21:03 +03:00

Fix a NULL pointer deference following malloc failure. Bug discovered

by klocwork. (CVS 3328)

FossilOrigin-Name: eb91612f4646b15c2b8398c5225669419b03b531
This commit is contained in:
drh
2006-07-11 12:40:25 +00:00
parent f64afeb53f
commit 76f8079623
4 changed files with 15 additions and 13 deletions

View File

@@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.190 2006/06/27 13:20:21 drh Exp $
** $Id: util.c,v 1.191 2006/07/11 12:40:25 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -1357,8 +1357,10 @@ void *sqlite3HexToBlob(const char *z){
if( n%2 ) return 0;
zBlob = (char *)sqliteMalloc(n/2);
for(i=0; i<n; i+=2){
zBlob[i/2] = (hexToInt(z[i])<<4) | hexToInt(z[i+1]);
if( zBlob ){
for(i=0; i<n; i+=2){
zBlob[i/2] = (hexToInt(z[i])<<4) | hexToInt(z[i+1]);
}
}
return zBlob;
}