mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-14 13:28:31 +00:00
[core] Coverity fixes
* [core] Coverity CID 1468218 (Resource leak) * [core] Coverity CID 1468214 (Resource leak) * [core] Coverity CID 1294472 (Resource leak) * [core] Coverity CID 1294470 (Resource leak) * [core] Coverity CID 1500361 (Resource leak) * [core] Coverity CID 1500308 (Resource leak) * [core] Coverity CID 1500278 (Resource leak) --------- Co-authored-by: Andrey Volk <andywolk@gmail.com>
This commit is contained in:
1 parent
04dd67da00
commit
49c1c35982
8 files changed
+49
-20
No files matched your search
+22
-13
@@ -3521,11 +3521,18 @@ SWITCH_DECLARE(switch_status_t) switch_img_to_raw(switch_image_t *src, void *des
|
||||
#endif
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t *dest, void *src, switch_img_fmt_t fmt, int width, int height)
|
||||
SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t **destP, void *src, switch_img_fmt_t fmt, int width, int height)
|
||||
{
|
||||
#ifdef SWITCH_HAVE_YUV
|
||||
uint32_t fourcc;
|
||||
int ret = -1;
|
||||
switch_image_t *dest = NULL;
|
||||
|
||||
if (!destP) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
dest = *destP;
|
||||
|
||||
fourcc = switch_img_fmt2fourcc(fmt);
|
||||
|
||||
@@ -3574,6 +3581,8 @@ SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t *dest, void *
|
||||
0, fourcc);
|
||||
}
|
||||
|
||||
*destP = dest;
|
||||
|
||||
return ret == 0 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
|
||||
#else
|
||||
return SWITCH_STATUS_FALSE;
|
||||
@@ -3586,10 +3595,12 @@ SWITCH_DECLARE(switch_status_t) switch_img_scale(switch_image_t *src, switch_ima
|
||||
switch_image_t *dest = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if (destP) {
|
||||
dest = *destP;
|
||||
if (!destP) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
dest = *destP;
|
||||
|
||||
switch_assert(width > 0);
|
||||
switch_assert(height > 0);
|
||||
|
||||
@@ -3615,15 +3626,13 @@ SWITCH_DECLARE(switch_status_t) switch_img_scale(switch_image_t *src, switch_ima
|
||||
kFilterBox);
|
||||
}
|
||||
|
||||
*destP = dest;
|
||||
|
||||
if (ret != 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Scaling Error: ret: %d\n", ret);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (destP) {
|
||||
*destP = dest;
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
#else
|
||||
return SWITCH_STATUS_FALSE;
|
||||
@@ -3637,10 +3646,12 @@ SWITCH_DECLARE(switch_status_t) switch_img_mirror(switch_image_t *src, switch_im
|
||||
switch_image_t *dest = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if (destP) {
|
||||
dest = *destP;
|
||||
if (!destP) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
dest = *destP;
|
||||
|
||||
if (dest && src->fmt != dest->fmt) switch_img_free(&dest);
|
||||
|
||||
if (!dest) dest = switch_img_alloc(NULL, src->fmt, src->d_w, src->d_h, 1);
|
||||
@@ -3660,15 +3671,13 @@ SWITCH_DECLARE(switch_status_t) switch_img_mirror(switch_image_t *src, switch_im
|
||||
|
||||
}
|
||||
|
||||
*destP = dest;
|
||||
|
||||
if (ret != 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Mirror Error: ret: %d\n", ret);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (destP) {
|
||||
*destP = dest;
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
#else
|
||||
return SWITCH_STATUS_FALSE;
|
||||
|
||||
Reference in new issue
Block a user