Skip to content

Commit 89055ff

Browse files
committed
janus: Simplify prev commit 2453e8f
1 parent bc5a87a commit 89055ff

1 file changed

Lines changed: 8 additions & 16 deletions

File tree

modules/janus/janus_common.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -230,39 +230,31 @@ int populate_janus_handler_id(janus_connection *conn, cJSON *request)
230230
if (aux == NULL || aux->type != cJSON_String ||
231231
(reply_status.s = aux->valuestring) == NULL) {
232232
char *dbg = cJSON_Print(request);
233-
LM_ERR("Unexpected JANUS reply received - %s\n",
234-
dbg ? dbg : "(null)");
235-
if (dbg)
236-
pkg_free(dbg);
233+
LM_ERR("Unexpected JANUS reply received - %s\n", dbg);
234+
pkg_free(dbg);
237235
return -1;
238236
}
239237

240238
if (memcmp(reply_status.s,"success",7) != 0) {
241239
char *dbg = cJSON_Print(request);
242-
LM_ERR("non-succesful JANUS reply received - %s\n",
243-
dbg ? dbg : "(null)");
244-
if (dbg)
245-
pkg_free(dbg);
240+
LM_ERR("non-succesful JANUS reply received - %s\n", dbg);
241+
pkg_free(dbg);
246242
return -1;
247243
}
248244

249245
aux = cJSON_GetObjectItem(request, "data");
250246
if (aux == NULL || aux->type != cJSON_Object) {
251247
char *dbg = cJSON_Print(request);
252-
LM_ERR("Unexpected JANUS reply received, no data in %s\n",
253-
dbg ? dbg : "(null)");
254-
if (dbg)
255-
pkg_free(dbg);
248+
LM_ERR("Unexpected JANUS reply received, no data in %s\n", dbg);
249+
pkg_free(dbg);
256250
return -1;
257251
}
258252

259253
aux2 = cJSON_GetObjectItem(aux, "id");
260254
if (aux2 == NULL || aux2->type != cJSON_Number) {
261255
char *dbg = cJSON_Print(request);
262-
LM_ERR("Unexpected JANUS reply received, id is not number %s\n",
263-
dbg ? dbg : "(null)");
264-
if (dbg)
265-
pkg_free(dbg);
256+
LM_ERR("Unexpected JANUS reply received, id is not number %s\n", dbg);
257+
pkg_free(dbg);
266258
return -1;
267259
}
268260

0 commit comments

Comments
 (0)