Check-in [cce89a2a07]

Not logged in

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

Overview
SHA1 Hash:cce89a2a078b7bfeaa4f03b002fa767495cd338d
Date: 2008-11-13 17:30:16
User: stephan
Comment:fixed a potential leak when re-setting an existing prop to a null value via c11n_node_prop_set(). Removed a debug line.
Changes
hide diffs unified diffs patch

Changes to src/c11n.c

Old (990f02615e6eab44) New (fa8e376b283de72d)
1 /** 1 /**
2 This the main implementation file for the c11n core library. Some 2 This the main implementation file for the c11n core library. Some
3 maintenance notes: 3 maintenance notes:
4 4
5 - NO dependency on any code from the c11n_io API is allowed. 5 - NO dependency on any code from the c11n_io API is allowed.
383 hidden lines
389 kvp = c11n_kvp_set_add(&n->kvp); 389 kvp = c11n_kvp_set_add(&n->kvp);
390 if( ! kvp ) 390 if( ! kvp )
391 { 391 {
392 return false; 392 return false;
393 } 393 }
> 394 //C11N_LOG(C11N_LOG_ALWAYS)("setting [%s] = [%s]", key, val );
394 kvp->key = key; 395 kvp->key = key;
395 kvp->value = val; 396 kvp->value = val;
396 return true; 397 return true;
397 } 398 }
398 399
399 bool c11n_node_prop_set( c11n_node * n, c11n_key_type key, c11n_const_string_t val ) 400 bool c11n_node_prop_set( c11n_node * n, c11n_key_type key, c11n_const_string_t val )
400 { 401 {
> 402 if( !n || !key ) return false;
401 /* 403 /*
402 Maybe todo: don't implement in terms of c11n_node_prop_give_kvp() because 404 Maybe todo: don't implement in terms of c11n_node_prop_give_kvp() because
403 doing so costs us one extra copy of key when re-setting an existing 405 doing so costs us one extra copy of key when re-setting an existing
404 property. 406 property.
405 */ 407 */
1033 hidden lines
1439 #undef C11N_MARSHALLER_INIT 1441 #undef C11N_MARSHALLER_INIT
1440 #undef C11N_MARSHALLER_API_DEFAULT 1442 #undef C11N_MARSHALLER_API_DEFAULT
1441 #ifdef __cplusplus 1443 #ifdef __cplusplus
1442 } /* extern "C" */ 1444 } /* extern "C" */
1443 #endif 1445 #endif