Ticket #523: cli-command.2.diff

File cli-command.2.diff, 1.9 KB (added by mkbosmans, 3 years ago)
  • src/pulsecore/cli-command.c

    From eac120c5033b9422c4e16ef50ca5afcec9e9d051 Mon Sep 17 00:00:00 2001
    From: Maarten Bosmans <mkbosmans@gmail.com>
    Date: Mon, 30 Mar 2009 16:24:18 +0200
    Subject: [PATCH] handle failure to parse proplist in cli-command gracefully
    
    ---
     src/pulsecore/cli-command.c |   20 ++++++++++++++++----
     1 files changed, 16 insertions(+), 4 deletions(-)
    
    diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
    index 4017cb6..3ea1dca 100644
    a b  
    699699        return -1; 
    700700    } 
    701701 
    702     p = pa_proplist_from_string(s); 
     702    if (!(p = pa_proplist_from_string(s))) { 
     703        pa_strbuf_puts(buf, "Failed to parse proplist.\n"); 
     704        return -1; 
     705    } 
    703706 
    704707    pa_sink_update_proplist(sink, PA_UPDATE_REPLACE, p); 
    705708 
     
    733736        return -1; 
    734737    } 
    735738 
    736     p = pa_proplist_from_string(s); 
     739    if (!(p = pa_proplist_from_string(s))) { 
     740        pa_strbuf_puts(buf, "Failed to parse proplist.\n"); 
     741        return -1; 
     742    } 
    737743 
    738744    pa_source_update_proplist(source, PA_UPDATE_REPLACE, p); 
    739745 
     
    773779        return -1; 
    774780    } 
    775781 
    776     p = pa_proplist_from_string(s); 
     782    if (!(p = pa_proplist_from_string(s))) { 
     783        pa_strbuf_puts(buf, "Failed to parse proplist.\n"); 
     784        return -1; 
     785    } 
    777786 
    778787    pa_sink_input_update_proplist(si, PA_UPDATE_REPLACE, p); 
    779788 
     
    813822        return -1; 
    814823    } 
    815824 
    816     p = pa_proplist_from_string(s); 
     825    if (!(p = pa_proplist_from_string(s))) { 
     826        pa_strbuf_puts(buf, "Failed to parse proplist.\n"); 
     827        return -1; 
     828    } 
    817829 
    818830    pa_source_output_update_proplist(so, PA_UPDATE_REPLACE, p); 
    819831