소스 검색

Handle RATP station name if it can't allocate memory

DocSystem 1 년 전
부모
커밋
298c5f793c
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      api/calypso/transit/navigo.c

+ 4 - 1
api/calypso/transit/navigo.c

@@ -252,7 +252,10 @@ char* get_navigo_station(
         if(station_group_id < 32 && station_id < 16) {
             const char* station_name = NAVIGO_RATP_LOCATION_LIST[station_group_id][station_id];
             if(station_name) {
-                return strdup(station_name);
+                char* station;
+                if((station = strdup(station_name)) != NULL) {
+                    return station;
+                }
             }
         }
         // cast station_group_id-station_id to a string