• Peter Wu's avatar
    switch_xml_set_attr: fix inconsistent state on error paths · b6831996
    Peter Wu 提交于
    Partially rewrite switch_xml_set_attr to fix memory leaks, uninitialized
    argument values and use-after free warnings from Clang static analyzer.
    
    Fixes these problems:
    
     - Add some comments and a new variable such that the code can more
       easily be audited / understood.
     - Always clear SWITCH_XML_DUP flag even if an error occurred to prevent
       free()'ing static strings on future invocations.
     - Keep the attribute list in a consistent state even if one of the
       memory allocation fails.
     - Keep allocation metadata in a consistent state when shrinking of the
       attribute lists fails. Previously the metadata was not updated,
       resulting in a wrong mapping from attributes to allocation flags.
     - Fix memory leaks when allocations fail.
    
    Previous behavior: invalid memory accesses are possible after a memory
    allocation failure, previous attributes may be lost.
    New behavior: attributes list is always valid, a new attribute is either
    set (or not), attributes can always be removed.
    b6831996
名称
最后提交
最后更新
..
include 正在载入提交数据...
mod 正在载入提交数据...
.gitignore 正在载入提交数据...
CMakeLists.txt 正在载入提交数据...
Makefile.am 正在载入提交数据...
fs_encode.c 正在载入提交数据...
g711.c 正在载入提交数据...
inet_pton.c 正在载入提交数据...
switch.c 正在载入提交数据...
switch_apr.c 正在载入提交数据...
switch_buffer.c 正在载入提交数据...
switch_caller.c 正在载入提交数据...
switch_channel.c 正在载入提交数据...
switch_config.c 正在载入提交数据...
switch_console.c 正在载入提交数据...
switch_core.c 正在载入提交数据...
switch_core_asr.c 正在载入提交数据...
switch_core_cert.c 正在载入提交数据...
switch_core_codec.c 正在载入提交数据...
switch_core_db.c 正在载入提交数据...
switch_core_directory.c 正在载入提交数据...
switch_core_event_hook.c 正在载入提交数据...
switch_core_file.c 正在载入提交数据...
switch_core_hash.c 正在载入提交数据...
switch_core_io.c 正在载入提交数据...
switch_core_media.c 正在载入提交数据...
switch_core_media_bug.c 正在载入提交数据...
switch_core_memory.c 正在载入提交数据...
switch_core_port_allocator.c 正在载入提交数据...
switch_core_rwlock.c 正在载入提交数据...
switch_core_session.c 正在载入提交数据...
switch_core_speech.c 正在载入提交数据...
switch_core_sqldb.c 正在载入提交数据...
switch_core_state_machine.c 正在载入提交数据...
switch_core_timer.c 正在载入提交数据...
switch_core_video.c 正在载入提交数据...
switch_cpp.cpp 正在载入提交数据...
switch_curl.c 正在载入提交数据...
switch_dso.c 正在载入提交数据...
switch_event.c 正在载入提交数据...
switch_hashtable.c 正在载入提交数据...
switch_ivr.c 正在载入提交数据...
switch_ivr_async.c 正在载入提交数据...
switch_ivr_bridge.c 正在载入提交数据...
switch_ivr_menu.c 正在载入提交数据...
switch_ivr_originate.c 正在载入提交数据...
switch_ivr_play_say.c 正在载入提交数据...
switch_ivr_say.c 正在载入提交数据...
switch_jitterbuffer.c 正在载入提交数据...
switch_json.c 正在载入提交数据...
switch_limit.c 正在载入提交数据...
switch_loadable_module.c 正在载入提交数据...
switch_log.c 正在载入提交数据...
switch_mprintf.c 正在载入提交数据...
switch_nat.c 正在载入提交数据...
switch_odbc.c 正在载入提交数据...
switch_pcm.c 正在载入提交数据...
switch_pgsql.c 正在载入提交数据...
switch_profile.c 正在载入提交数据...
switch_regex.c 正在载入提交数据...
switch_resample.c 正在载入提交数据...
switch_rtp.c 正在载入提交数据...
switch_scheduler.c 正在载入提交数据...
switch_sdp.c 正在载入提交数据...
switch_speex.c 正在载入提交数据...
switch_stun.c 正在载入提交数据...
switch_swig.c 正在载入提交数据...
switch_swig.i 正在载入提交数据...
switch_time.c 正在载入提交数据...
switch_utf8.c 正在载入提交数据...
switch_utils.c 正在载入提交数据...
switch_version.c 正在载入提交数据...
switch_xml.c 正在载入提交数据...
switch_xml_config.c 正在载入提交数据...
tone2wav.c 正在载入提交数据...