mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	avoid some leaks and NULL pointer derefs
This commit is contained in:
		
							parent
							
								
									2fd64f1591
								
							
						
					
					
						commit
						dac60d4e5b
					
				
					 3 changed files with 8 additions and 1 deletions
				
			
		| 
						 | 
					@ -189,6 +189,9 @@ setup_props(struct pw_context *context, struct spa_node *spa_node, struct pw_pro
 | 
				
			||||||
		if ((prop = spa_pod_find_prop(props, prop, type))) {
 | 
							if ((prop = spa_pod_find_prop(props, prop, type))) {
 | 
				
			||||||
			const char *value = pw_properties_get(pw_props, key);
 | 
								const char *value = pw_properties_get(pw_props, key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (value == NULL)
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			pw_log_debug("configure prop %s to %s", key, value);
 | 
								pw_log_debug("configure prop %s to %s", key, value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			switch(prop->value.type) {
 | 
								switch(prop->value.type) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -132,8 +132,10 @@ static int alloc_buffers(struct pw_mempool *pool,
 | 
				
			||||||
				PW_MEMBLOCK_FLAG_MAP,
 | 
									PW_MEMBLOCK_FLAG_MAP,
 | 
				
			||||||
				SPA_DATA_MemFd,
 | 
									SPA_DATA_MemFd,
 | 
				
			||||||
				n_buffers * info.mem_size);
 | 
									n_buffers * info.mem_size);
 | 
				
			||||||
		if (m == NULL)
 | 
							if (m == NULL) {
 | 
				
			||||||
 | 
								free(buffers);
 | 
				
			||||||
			return -errno;
 | 
								return -errno;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		data = m->map->ptr;
 | 
							data = m->map->ptr;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -181,6 +181,8 @@ pw_properties_new_string(const char *str)
 | 
				
			||||||
		if (eq && eq != val) {
 | 
							if (eq && eq != val) {
 | 
				
			||||||
			*eq = '\0';
 | 
								*eq = '\0';
 | 
				
			||||||
			add_func(&impl->this, val, strdup(eq+1));
 | 
								add_func(&impl->this, val, strdup(eq+1));
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								free(val);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		s = pw_split_walk(str, " \t\n\r", &len, &state);
 | 
							s = pw_split_walk(str, " \t\n\r", &len, &state);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue