2014-09-23 13:18 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* contrib/hbcurl/core.c
    ! added protection against operation on NULL pointers borrowed from
      Viktor's branch.
This commit is contained in:
Przemysław Czerpak
2014-09-23 13:18:53 +02:00
parent daa2a7f0cd
commit 2dff2df00e
2 changed files with 26 additions and 15 deletions

View File

@@ -10,6 +10,11 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2014-09-23 13:18 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbcurl/core.c
! added protection against operation on NULL pointers borrowed from
Viktor's branch.
2014-09-23 11:41 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/gtqtc/gtqtc1.cpp
* src/rtl/gtwvt/gtwvt.c

View File

@@ -165,19 +165,24 @@ static HB_HASH_FUNC( hb_curl_HashCmp )
static const char * hb_curl_StrHashNew( PHB_CURL hb_curl, const char * szValue )
{
char * szHash;
if( ! hb_curl->pHash )
hb_curl->pHash = hb_hashTableCreate( HB_CURL_HASH_TABLE_SIZE,
hb_curl_HashKey, hb_curl_HashDel, hb_curl_HashCmp );
szHash = ( char * ) hb_hashTableFind( hb_curl->pHash, szValue );
if( ! szHash )
if( szValue )
{
szHash = hb_strdup( szValue );
hb_hashTableAdd( hb_curl->pHash, szHash, szHash );
char * szHash;
if( ! hb_curl->pHash )
hb_curl->pHash = hb_hashTableCreate( HB_CURL_HASH_TABLE_SIZE,
hb_curl_HashKey, hb_curl_HashDel, hb_curl_HashCmp );
szHash = ( char * ) hb_hashTableFind( hb_curl->pHash, szValue );
if( ! szHash )
{
szHash = hb_strdup( szValue );
hb_hashTableAdd( hb_curl->pHash, szHash, szHash );
}
return szHash;
}
return szHash;
else
return NULL;
}
# define hb_curl_StrHash( c, s ) hb_curl_StrHashNew( ( c ), ( s ) )
@@ -193,17 +198,18 @@ static const char * hb_curl_StrHashNew( PHB_CURL hb_curl, const char * szValue )
static void * hb_curl_xgrab( size_t size )
{
return hb_xgrab( size );
return size > 0 ? hb_xgrab( size ) : NULL;
}
static void hb_curl_xfree( void * p )
{
hb_xfree( p );
if( p )
hb_xfree( p );
}
static void * hb_curl_xrealloc( void * p, size_t size )
{
return hb_xrealloc( p, size );
return size > 0 ? ( p ? hb_xrealloc( p, size ) : hb_xgrab( size ) ) : NULL;
}
static char * hb_curl_strdup( const char * s )
@@ -389,7 +395,7 @@ static int hb_curl_progress_callback( void * Cargo, double dltotal, double dlnow
{
hb_vmPushEvalSym();
hb_vmPush( ( PHB_ITEM ) Cargo );
hb_vmPushDouble( ulnow > 0 ? ulnow : dlnow, HB_DEFAULT_DECIMALS );
hb_vmPushDouble( ulnow > 0 ? ulnow : dlnow, HB_DEFAULT_DECIMALS );
hb_vmPushDouble( ultotal > 0 ? ultotal : dltotal, HB_DEFAULT_DECIMALS );
hb_vmSend( 2 );