Skip to content

Please confirm whether the changes in version v1.7.19 have caused any issues. #961

@lillianokok

Description

@lillianokok

Environment Information:
cat /etc/os-release
NAME="openEuler"
VERSION="20.03 (LTS)"
ID="openEuler"

Operation Steps:
1、spack install --keep-stage --dont-restage --no-checksum -y cjson@1.7.19
2、Load environment variables
3、cat test2.c

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cJSON.h"

int main()
{
        cJSON *json,*json_name,*json_passwd,*json_num;
        char* out="{\"name\":\"fengxin\",\"passwd\":\"123\",\"num\":0}";

        json = cJSON_Parse(out); 
        json_name = cJSON_GetObjectItem( json , "name" );  
        json_passwd = cJSON_GetObjectItem( json , "passwd" );
        json_num = cJSON_GetObjectItem( json , "num" );


        printf("name:%s,passwd:%s,num:%d\n",json_name->valuestring,json_passwd->valuestring);
        cJSON_Delete(json);  
        //free(out);

}

4、gcc test2.c cJSON.c -o test2
5、./test2 Actual result:
./test2
name:fengxin,passwd:123,num:754517056

Please confirm why the execution result is not as follows:
Expected result:
./test2
name: fengxin, passwd: 123, num: 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions