Browse Source

MT#56759 use g_strdup_printf

instead of asprintf

Change-Id: I936aeecc49767f758e95d07f4092dd72a8175947
pull/1642/head
Richard Fuchs 3 years ago
parent
commit
ef174541c6
1 changed files with 5 additions and 9 deletions
  1. +5
    -9
      daemon/recording.c

+ 5
- 9
daemon/recording.c View File

@ -340,11 +340,10 @@ void recording_start(struct call *call, const char *prefix, str *output_dest) {
const int rand_bytes = 8; const int rand_bytes = 8;
char rand_str[rand_bytes * 2 + 1]; char rand_str[rand_bytes * 2 + 1];
rand_hex_str(rand_str, rand_bytes); rand_hex_str(rand_str, rand_bytes);
if (asprintf(&recording->meta_prefix, "%s-%s", recording->escaped_callid, rand_str) < 0)
abort();
recording->meta_prefix = g_strdup_printf("%s-%s", recording->escaped_callid, rand_str);
} }
else else
recording->meta_prefix = strdup(prefix);
recording->meta_prefix = g_strdup(prefix);
_rm(init_struct, call); _rm(init_struct, call);
@ -447,10 +446,7 @@ static void rec_pcap_init(struct call *call) {
} }
static char *file_path_str(const char *id, const char *prefix, const char *suffix) { static char *file_path_str(const char *id, const char *prefix, const char *suffix) {
char *ret;
if (asprintf(&ret, "%s%s%s%s", spooldir, prefix, id, suffix) < 0)
abort();
return ret;
return g_strdup_printf("%s%s%s%s", spooldir, prefix, id, suffix);
} }
/** /**
@ -575,7 +571,7 @@ static void rec_pcap_meta_finish_file(struct call *call) {
} }
mutex_destroy(&recording->u.pcap.recording_lock); mutex_destroy(&recording->u.pcap.recording_lock);
g_clear_pointer(&recording->u.pcap.meta_filepath, free);
g_clear_pointer(&recording->u.pcap.meta_filepath, g_free);
} }
@ -706,7 +702,7 @@ void recording_finish(struct call *call) {
_rm(finish, call); _rm(finish, call);
g_clear_pointer(&recording->meta_prefix, free);
g_clear_pointer(&recording->meta_prefix, g_free);
g_clear_pointer(&recording->escaped_callid, free); g_clear_pointer(&recording->escaped_callid, free);
g_slice_free1(sizeof(*(recording)), recording); g_slice_free1(sizeof(*(recording)), recording);


Loading…
Cancel
Save