|  | @@ -234,12 +234,19 @@ static cJSON *cJSONUtils_PatchDetach(cJSON *object, const char *path)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /* copy path and split it in parent and child */
 | 
	
		
			
				|  |  |      parentptr = cJSONUtils_strdup(path);
 | 
	
		
			
				|  |  | +    if (parentptr == NULL) {
 | 
	
		
			
				|  |  | +        return NULL;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      childptr = strrchr(parentptr, '/'); /* last '/' */
 | 
	
		
			
				|  |  | -    if (childptr)
 | 
	
		
			
				|  |  | +    if (childptr == NULL)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  | -        /* split strings */
 | 
	
		
			
				|  |  | -        *childptr++ = '\0';
 | 
	
		
			
				|  |  | +        free(parentptr);
 | 
	
		
			
				|  |  | +        return NULL;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    /* split strings */
 | 
	
		
			
				|  |  | +    *childptr++ = '\0';
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      parent = cJSONUtils_GetPointer(object, parentptr);
 | 
	
		
			
				|  |  |      cJSONUtils_InplaceDecodePointerString(childptr);
 | 
	
		
			
				|  |  |  
 |