[libmm-camcorder] g_free and g_printf function fixes
[platform/core/multimedia/libmm-camcorder.git] / src / mm_camcorder_audiorec.c
index 8362140..4cfbb72 100644 (file)
@@ -408,7 +408,7 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
                                goto _ERR_CAMCORDER_AUDIO_COMMAND;
                        }
 
-                       info->filename = strdup(temp_filename);
+                       info->filename = g_strdup(temp_filename);
                        if (!info->filename) {
                                _mmcam_dbg_err("STRDUP was failed");
                                goto _ERR_CAMCORDER_AUDIO_COMMAND;
@@ -541,8 +541,7 @@ _mmcamcorder_audio_command(MMHandleType handle, int command)
                if (info->filename) {
                        _mmcam_dbg_log("file delete(%s)", info->filename);
                        unlink(info->filename);
-                       g_free(info->filename);
-                       info->filename = NULL;
+                       SAFE_G_FREE(info->filename);
                }
                break;
 
@@ -655,7 +654,7 @@ int _mmcamcorder_audio_handle_eos(MMHandleType handle)
 
        /* Send recording report message to application */
        msg.id = MM_MESSAGE_CAMCORDER_AUDIO_CAPTURED;
-       report = (MMCamRecordingReport*) malloc(sizeof(MMCamRecordingReport));
+       report = (MMCamRecordingReport*) g_malloc(sizeof(MMCamRecordingReport));
        if (!report) {
                _mmcam_dbg_err("Recording report fail(%s). Out of memory.", info->filename);
                return FALSE;
@@ -668,7 +667,7 @@ int _mmcamcorder_audio_handle_eos(MMHandleType handle)
        }
 /* END TAG HERE */
 
-       report->recording_filename = strdup(info->filename);
+       report->recording_filename = g_strdup(info->filename);
        msg.param.data= report;
 
        _mmcamcorder_send_message(handle, &msg);
@@ -686,8 +685,7 @@ int _mmcamcorder_audio_handle_eos(MMHandleType handle)
        sc->isMaxsizePausing = FALSE;
        sc->isMaxtimePausing = FALSE;
 
-       g_free(info->filename);
-       info->filename = NULL;
+       SAFE_G_FREE(info->filename);
 
        _mmcam_dbg_err("_MMCamcorder_CMD_COMMIT : end");