OSDN Git Service

Fix an inappropriate sscanf return value judgment
authorliuchao <liuchao741@huawei.com>
Wed, 4 Jan 2017 02:46:06 +0000 (10:46 +0800)
committerMarie Janssen <jamuraa@google.com>
Wed, 4 Jan 2017 18:59:44 +0000 (18:59 +0000)
This fixes an inappropriate sscanf return value judgment that
res check here is not needed while res2 is the one that need to be checked

Test: mm -j 8
Change-Id: I3e332286c9434d5b9d01421f5f421039f84ad6c7

bta/hf_client/bta_hf_client_at.cc

index e6a7923..8bd55ed 100644 (file)
@@ -1246,7 +1246,7 @@ static char* bta_hf_client_parse_clcc(tBTA_HF_CLIENT_CB* client_cb,
 
     if (res2 == 0) {
       res2 = sscanf(buffer, ",\"\",%hu%n", &type, &offset);
-      if (res < 0) return NULL;
+      if (res2 < 0) return NULL;
 
       /* numstr is not matched in second attempt, correct this */
       res2++;