Michal Vasko | 1324b6c | 2018-09-07 11:16:23 +0200 | [diff] [blame] | 1 | /** |
| 2 | * @file common.c |
| 3 | * @author Michal Vasko <mvasko@cesnet.cz> |
| 4 | * @brief common internal definitions for libyang |
| 5 | * |
| 6 | * Copyright (c) 2018 CESNET, z.s.p.o. |
| 7 | * |
| 8 | * This source code is licensed under BSD 3-Clause License (the "License"). |
| 9 | * You may not use this file except in compliance with the License. |
| 10 | * You may obtain a copy of the License at |
| 11 | * |
| 12 | * https://opensource.org/licenses/BSD-3-Clause |
| 13 | */ |
| 14 | |
| 15 | #include <stdlib.h> |
| 16 | |
| 17 | void * |
| 18 | ly_realloc(void *ptr, size_t size) |
| 19 | { |
| 20 | void *new_mem; |
| 21 | |
| 22 | new_mem = realloc(ptr, size); |
| 23 | if (!new_mem) { |
| 24 | free(ptr); |
| 25 | } |
| 26 | |
| 27 | return new_mem; |
| 28 | } |