fix(span): explicitly set span->txt to the return value of lv_mem_realloc(#3005)

* Update lv_span.c

Explicitly set `span->txt` to return of `lv_mem_realloc`

* Update lv_mem.h

Add note about `lv_mem_realloc` return value on failure
This commit is contained in:
Carlos Diaz
2022-01-17 06:18:19 -06:00
committed by GitHub
parent 138db9c5d6
commit a9a6cb8efd
2 changed files with 2 additions and 2 deletions

View File

@@ -152,7 +152,7 @@ void lv_span_set_text(lv_span_t * span, const char * text)
span->txt = lv_mem_alloc(strlen(text) + 1);
}
else {
lv_mem_realloc(span->txt, strlen(text) + 1);
span->txt = lv_mem_realloc(span->txt, strlen(text) + 1);
}
span->static_flag = 0;
strcpy(span->txt, text);

View File

@@ -84,7 +84,7 @@ void lv_mem_free(void * data);
* @param data pointer to an allocated memory.
* Its content will be copied to the new memory block and freed
* @param new_size the desired new size in byte
* @return pointer to the new memory
* @return pointer to the new memory, NULL on failure
*/
void * lv_mem_realloc(void * data_p, size_t new_size);