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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user