diff --git a/common_zte.c b/common_zte.c index fd9dc2942e8359c6e4adc094744ac844b6b77b6a..1e42a83211149f060411e2d26dc2b21ede66707b 100644 --- a/common_zte.c +++ b/common_zte.c @@ -4,7 +4,7 @@ int print_to_ubus(struct json_object *parsed_response, struct ubus_context *ctx, { struct blob_buf bb; - memset(&bb, 0, sizeof(struct blob_buf)); + memset(&bb, 0, sizeof(bb)); blob_buf_init(&bb, 0); bb = json_to_blob(parsed_response, bb); ubus_send_reply(ctx, req, bb.head); diff --git a/dongle_infrastructure.c b/dongle_infrastructure.c index 9cb71c07988d4f660328c0daafb3e18f516cf2c3..71d0c53a104b0d79e963d143552a201399b0c1f6 100644 --- a/dongle_infrastructure.c +++ b/dongle_infrastructure.c @@ -443,7 +443,7 @@ int print_list(struct ubus_context *ctx, struct ubus_object *obj, void *arr, *table; int rv; - memset(&bb, 0, sizeof(struct blob_buf)); + memset(&bb, 0, sizeof(bb)); rv = blob_buf_init(&bb, 0); if (rv != 0) goto fail; diff --git a/libmobile_hilink.c b/libmobile_hilink.c index c4a7499fd3655966f2649cddc4f1c434a02ac244..c29480ba1f51408fc722985bb7413cf94252d830 100644 --- a/libmobile_hilink.c +++ b/libmobile_hilink.c @@ -18,7 +18,7 @@ char *parser(char *data, char *keyword) char *session_token; char *ptr = NULL; - session_token = (char *)calloc(1024, sizeof(char)); + session_token = (char *)calloc(1024, sizeof(*session_token)); if (!session_token) goto leave_token; @@ -64,11 +64,11 @@ static size_t write_response(void *ptr, size_t size, size_t nmemb, void *stream) struct write_result *memalloc_write_result(void) { - struct write_result *wr = (struct write_result *) calloc(1, sizeof(struct write_result)); + struct write_result *wr = (struct write_result *) calloc(1, sizeof(*wr)); if (!wr) goto leave; - wr->data = calloc(BUFFER_SIZE, sizeof(char)); + wr->data = calloc(BUFFER_SIZE, sizeof(wr->data)); if (!wr->data) goto leave; diff --git a/libmobile_zte.c b/libmobile_zte.c index 8ff52cb59f1fe56fd19c85c7e9cfe61b9b089f6c..1ee559bc7aff69e213dbc52bf3926e60aa70f508 100644 --- a/libmobile_zte.c +++ b/libmobile_zte.c @@ -282,7 +282,7 @@ static struct json_object *prepare_request(char *ip_addr, char *query, int optio struct string str = {NULL, 0}; struct json_object *parsed_response; - str.ptr = calloc(1, 1); + str.ptr = (char *)calloc(1, 1); if (!str.ptr) { //debug_print("Error allocating memory with calloc"); goto fail;