Skip to content

Commit a4150b2

Browse files
authored
fix(stdio): use before check (estkme-group#340)
1 parent fdb98b5 commit a4150b2

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

driver/apdu/stdio.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <stdio.h>
55
#include <stdlib.h>
66
#include <string.h>
7-
#include <unistd.h>
87

98
#include <cjson-ext/cJSON_ex.h>
109
#include <euicc/hexutil.h>
@@ -144,11 +143,11 @@ static int json_response(int *ecode, uint8_t **data, uint32_t *data_len) {
144143

145144
err:
146145
fret = -1;
147-
free(*data);
148-
if (data) {
146+
if (data != NULL) {
147+
free(*data);
149148
*data = NULL;
150149
}
151-
if (data_len) {
150+
if (data_len != NULL) {
152151
*data_len = 0;
153152
}
154153
*ecode = -1;

0 commit comments

Comments
 (0)