From a28a72acf58d70259faa67ffeba473a66ef6eb35 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Tue, 31 Jul 2012 23:12:24 +0200 Subject: [PATCH] Network: only strdup when there is actually data Signed-off-by: Paul Kocialkowski --- network.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/network.c b/network.c index 6b24467..62d359d 100644 --- a/network.c +++ b/network.c @@ -182,8 +182,10 @@ int at_creg_handle(char **registration_state, struct at_response_data **response } asprintf(&(registration_state[0]), "%d", state); - registration_state[1] = strdup(lac); - registration_state[2] = strdup(cid); + if(lac != NULL) + registration_state[1] = strdup(lac); + if(cid != NULL) + registration_state[2] = strdup(cid); return 0; } -- 2.11.0